Operating Systems Structures: Jerry Breecher
Operating Systems Structures: Jerry Breecher
Jerry Breecher
2: OS Structures
System Calls
How Components Fit Together Virtual Machine
2: OS Structures
SYSTEM COMPONENTS
These are the pieces of the system well be looking at: Process Management Main Memory Management File Management I/O System Management Secondary Management Networking Protection System Command-Interpreter System
2: OS Structures
3
SYSTEM COMPONENTS
A process is a program in execution: (A program is passive, a process active.) A process has resources (CPU time, files) and attributes that must be managed. One (or more) threads are the schedulable entities within a process. Management of processes includes: Thread Scheduling (priority, time management, . . . ) Creation/termination Block/Unblock (suspension/resumption ) Synchronization Communication Deadlock handling Debugging
2: OS Structures
System Components
MAIN MEMORY MANAGEMENT Allocation/de-allocation for processes, files, I/O. Maintenance of several processes at a time Keep track of who's using what memory Movement of process memory to/from secondary storage. FILE MANAGEMENT A file is a collection of related information defined by its creator. Commonly, files represent programs (both source and object forms) and data. The operating system is responsible for the following activities in connections with file management: File creation and deletion. Directory creation and deletion. Support of primitives for manipulating files and directories. Mapping files onto secondary storage. File backup on stable (nonvolatile) storage media. 2: OS Structures
5
System Components
I/O MANAGEMENT Buffer caching system Generic device driver code Drivers for each device - translate read/write requests into disk position commands.
SECONDARY STORAGE MANAGEMENT Disks, tapes, optical, ... Free space management ( paging/swapping )
2: OS Structures
System Components
NETWORKING Communication system between distributed processors. Getting information about files/processes/etc. on a remote machine. Can use either a message passing or a shared memory model. PROTECTION Of files, memory, CPU, etc. Means controlling of access Depends on the attributes of the file and user SYSTEM PROGRAMS
How Do These All Fit Together? In essence, they all provide services for each other.
Command Interpreters -- Program that accepts control statements (shell, GUI interface, etc.)
Compilers/linkers Communications (ftp, telnet, etc.)
2: OS Structures
7
System Tailoring
Modifying the Operating System program for a particular machine. The goal is to include all the necessary pieces, but not too many extra ones. Typically a System can support many possible devices, but any one installation has only a few of these possibilities.
Plug and play allows for detection of devices and automatic inclusion of the code (drivers) necessary to drive these devices.
2: OS Structures
System Calls
A System Call is the main way a user program interacts with the Operating System.
System Calls
There are 11 (or more) steps in making the system call read (fd, buffer, nbytes) 2: OS Structures
Linux API
10
System Calls
Example of Windows API
A description of the parameters passed to ReadFile() HANDLE filethe file to be read LPVOID buffera buffer where the data will be read into and written from DWORD bytesToReadthe number of bytes to be read into the buffer LPDWORD bytesReadthe number of bytes read during the last read LPOVERLAPPED ovlindicates if overlapped I/O is being used 2: OS Structures
11
System Calls
Msg Passing
Shared Memory
2: OS Structures
12
System Calls
2: OS Structures
13
Example of MS-DOS.
Application Programming
Note how all layers can touch the hardware. Bad News!!
MS-DOS Drivers
ROM - BIOS Device Drivers
2: OS Structures
14
System Services
VM Manager
Process Manager
IO Manager
2: OS Structures
16
Virtual Machine
In a Virtual Machine - each process "seems" to execute on its own processor with its own memory, devices, etc. The resources of the physical machine are shared. Virtual devices are sliced out of the physical ones. Virtual disks are subsets of physical ones. Useful for running different OS simultaneously on the same machine. Protection is excellent, but no sharing possible. Virtual privileged instructions are trapped.
Virtual User
Physical User
Virtual Machine
Monitor Mode
2: OS Structures
Physical Machine
17
Virtual Machine
2: OS Structures
18
Virtual Machine
DOS APPLICATION
Physical User
BIOS DRIVERS
Windows 2000
Physical Machine
2: OS Structures
19
Virtual Machine
VMware Example
2: OS Structures
20
Virtual Machine
2: OS Structures
21
2: OS Structures
22