Download Operating system organization

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Copland (operating system) wikipedia , lookup

Acorn MOS wikipedia , lookup

Burroughs MCP wikipedia , lookup

Spring (operating system) wikipedia , lookup

RSTS/E wikipedia , lookup

Distributed operating system wikipedia , lookup

CP/M wikipedia , lookup

Unix security wikipedia , lookup

DNIX wikipedia , lookup

VS/9 wikipedia , lookup

Process management (computing) wikipedia , lookup

Transcript

Create an abstract machine environment
A nicer environment than bare hardware
 Consists of multiple, autonomous abstract
components
 Components may be in use concurrently


Coordinate the use of the components


Resource manager
Manage according to the policies of the machine’s
administrator
2
Exact set of functions required depends on
engineering and marketing choices but each
function falls in one of these categories:




Device management
Process, thread, and resource management
Memory management
File management
3
File
Manager
Process, Thread &
Resource Manager
Processor(s)
Memory
Manager
Device
Manager
Main Memory
Devices
4

OS uses policies chosen by designer or system
administrator to manage
Allocation
 Isolation
 Sharing


Device manager in two parts


Device independent – provides unified interface
Device dependent – device driver: handles those
aspects unique to a device
5
Device-Independent
Part
Device-Dependent
Part
Device-Dependent
Part
Device
Device
Device-Dependent
Part
…
Device
6
Application
Process
System Interface
File
Manager
Device-Independent
Device-Dependent
Hardware Interface
Command
Status
Data
Device Controller
7
read(device, …);
1
9
8b
Data
System Interface
Device Status Table
read driver
2
4
7
Device
Handler
write driver
6
Interrupt
Handler
3
8a
5
Hardware Interface
Command
Status
Data
Device Controller
8
9
10
Process Mgr
Protection
Process
Description
Deadlock
Synchronization
Scheduler
Resource
Resource
Manager
Resource
Manager
Manager
CPU
Other H/W
11
Thread
Abstraction
Process
Abstraction
Generic
Resource
Manager
Multiprogramming
Other
Primary
Memory
…
Abstract
Resources
Processor
12
Isolation &
Sharing
Process
Manager
Block
Allocation
Primary
Memory
Virtual
Memory
Storage
Devices
13
14
15
16
17
Process/Thread
Admin
Scheduler
Virtual
Memory
File
Management
Synchronization
Device
Management
IPC
Deadlock
Management
Interrupt
Handler
Resource
Management
Protection
Mechanisms
Memory
Allocation
18
Application
Software
Application
Software
Application
Software
Application
Software
Other System
Software
Other System
Software
Other System
Software
Other System
Software
Other OS Functions
Other OS Functions
Other OS Functions
Other OS Functions
Kernel Functions
Nucleus Functions
Nucleus Functions
Nucleus Functions
Skeletal Nucleus
(a) Monolithic
(b) Modular
(c) Extensible
(d) Layered
(microkernel)
19

Two recurring issues in design



Performance
Exclusive use of resources
Three basic implementation mechanisms
Processor modes
 Kernels
 Method of invoking system service

20




Must be as efficient as possible in use of
resources (especially processor and memory)
Every design issue MUST be evaluated wrt its
contribution to functionality of system AND
its impact on performance
Seek to minimize “overhead” of the system
wrt the applications running on the system
Increased hardware performance does allow
added functionality in spite of inefficiency
21
22




Multiprogramming  resource sharing
Therefore, need software-controlled resource
isolation
Security policy: Sharing strategy chosen by
computer’s owner
Protection mechanism: Tool to implement a family
of security policies
23



Security depends on correct operation of
software  trusted vs. untrusted software
Need to insure that untrusted software cannot
change trusted software
Can limit the function of the OS


Guiding a manned spaceship
Managing a nuclear reactor
24

Mode bit: Supervisor or User mode


Supervisor mode (privileged, protected)



Some processors may have more than one mode
Can execute all machine instructions
Can reference all memory locations
User mode


Can only execute a subset of instructions
Can only reference a subset of memory locations
25

Ensures proper operation of a computer system




Protect the operating system and all other programs
and their data from any malfunctioning program
Protection is needed for any shared resource
Trusted OS software runs in supervisor mode
All other software runs in user mode
26

Supervisor mode



all instructions are legal
all addresses are absolute physical addresses (base
and bound are not used)
User mode


instructions that modify control registers are illegal
all addresses must be less than bound and have base
added to them
27


Instructions that can only be executed in the
supervisor mode are called supervisor, privileged,
or protected instructions
I/O instructions are privileged instructions



A user program in user mode cannot perform its own
I/O
Instruction to change the mode is a privileged
instruction
Instruction to set the halt flag is a privileged
instruction
28
Processor
Process A
Process B
A’s Protected
Object
Supervisor
Program


When A is using processor, register points to its
object
When B is using processor, register does not point to
A’s object
29

Kernels

Critical parts of OS that run in supervisor mode
 Have access to other parts of the kernel



Trusted software
Extensions to the OS execute in user mode
The trap instruction is used to switch from
user to supervisor mode, entering the OS
30
Mode
S
Branch Table
1
2
trap
3
Trusted
Code
User
Supervisor
31
…
fork();
…
Trap Table
fork() {
…
trap
N_SYS_FORK()
…
}
Kernel
sys_fork()
sys_fork() {
/* system function */
…
return;
}
32

Two techniques


System call
Message passing
call(…);
trap
return;
33

For the system

through a trap instruction which causes an interrupt
 Hardware saves PC and current status information
 Hardware changes mode to system mode
 Hardware loads PC from system call interrupt vector
location.
 Execute the system call interrupt handler
 return from the handler, restores PC and other saved
status information
 User process continues.
34
…
fork();
…
Trap Table
fork() {
…
trap
N_SYS_FORK()
…
}
Kernel
sys_fork()
sys_fork() {
/* system function */
…
return;
}
35

Parameter passing

Through registers
 System call number passed through register
 Parameters are passed through registers
 Returned value is also passed through a register to
C/C++

Through a table in memory
 Pass the address of the table in a register

Through the stack
 Push the parameters on the stack by the user program
 Pop the parameters off the stack by the O.S.
36
User Space
Kernel Space
Thread
fork();
sys_fork() {
}
37

Two techniques


System call
Message passing
send(…, A, …);
receive(…, B, …);
send/receive
receive(…A, …);
…
send(…, B, …);
38
File
Manager
Process, Thread &
Resource Manager
Processor(s)
Memory
Manager
Device
Manager
Main Memory
Devices
39






UNIX
MACH
MS-DOS
Windows NT
OS/2
MacOS
40


One of the most popular operating systems
First version released in 1969

By Ken Thompson & Dennis Ritchie at Bell Labs
 ACM Turing Award – 1983
 National Medal of Technology – 1999
 Japan Prize for Information and Communications –
2011
Widely used in universities and research
organizations
 Time-sharing system
 Supports multiple processes
 Disk files and I/O devices are treated similarly

41
42




Written in a high-level language.
Distributed in source form.
Provided powerful operating-system
primitives on an inexpensive platform.
Small size, modular, clean design.
43






Designed to be a time-sharing system
Has a simple standard user interface that can
be replaced.
File system with multilevel tree-structured
directories.
Files are supported by the kernel as
unstructured sequences of bytes.
Supports multiple processes; a process can
easily create new processes.
High priority given to making system
interactive, and providing facilities for
program development.
44
Interactive User
Device Driver
Device Driver
…
Device Driver
Driver Interface
Libraries
Application
Commands
…
Programs
OS System Call Interface
Trap Table
Monolithic Kernel Module
•Process Management
•Memory Management
•File Management
•Device Mgmt Infrastructure
45

UNIX is copyrighted – now supported by SCO


long litigious story there!
Open source variations

freebsd
 www.freebsd.org/availability.html

Linux
 many distributions
46


32-bit preemptive multitasking operating system for modern
microprocessors.
Key goals for the system:










portability
security
POSIX compliance
multiprocessor support
extensibility
international support
compatibility with MS-DOS and MS-Windows applications.
Uses a micro-kernel architecture.
Available in two versions, Windows NT Workstation and
Windows NT Server.
In 1996, more NT server licenses were sold than UNIX
licenses
47
T
Process
T
T
T
Process
Process
T T T T
T
Libraries
Subsystem
User
Process Management
Memory Management
File Management
Subsystem
Subsystem
Device Mgmt
Infrastructure
NT Executive
NT Kernel
Hardware Abstraction Layer
Processor(s)
Main Memory
I/O Subsystem
Devices
48

In 1988, Microsoft decided to develop a “new
technology” (NT) portable operating system that
supported both the OS/2 and POSIX APIs.

Originally, NT was supposed to use the OS/2 API as
its native environment but during development NT
was changed to use the Win32 API, reflecting the
popularity of Windows 3.0.
49

Extensibility — layered architecture.



NT executive, which runs in protected mode,
provides the basic system services.
On top of the executive, several server subsystems
operate in user mode.
Modular structure allows additional environmental
subsystems to be added without affecting the
executive.
50

Portability — NT can be moved from one
hardware architecture to another with
relatively few changes.
Written in C and C++.
 Processor-dependent code is isolated in a dynamic
link library (DLL) called the “hardware abstraction
layer” (HAL).


Reliability — NT uses hardware protection for
virtual memory, and software protection
mechanisms for operating system resources.
51


Compatibility — applications that follow the
IEEE 1003.1 (POSIX) standard can be complied
to run on NT without changing the source
code.
Performance — NT subsystems can
communicate with one another via highperformance message passing.



Preemption of low priority threads enables the
system to respond quickly to external events.
Designed for symmetrical multiprocessing.
International support — supports different
locales via the national language support (NLS)
API.
52



Layered system of modules.
Protected mode — HAL, kernel, executive.
User mode — collection of subsystems


Environmental subsystems emulate different
operating systems.
Protection subsystems provide security functions.
53