Chapter 3: Operating-System Structures
System Components
System Calls
System Programs
System Structure
Common System Components
Process Management
Main-Memory Management
File Management
I/O-System Management
Secondary-Storage Management
Networking
Protection System
Command-Interpreter System
Process Management
A process is a program in execution.
A process needs resources - CPU time, memory, files,and I/O devices
The operating system is responsible for
Process creation and deletion.
Process suspension and resumption.
Provision of mechanisms for:
process synchronization
process communication
deadlock handling
Ch4 - Ch8
Main-Memory Management
A program must be loaded into memory to be executed
Keep multiple processes in memory
Improve CPU utilization
Improve response speed to users
The operating system is responsible for:
Keeping track of who is using what parts of memory
Deciding which processes to load when memory space becomes available.
Allocating and de-allocating memory space as needed.
Ch9, Ch10
File Management
A file is a collection of related information defined by its creator.
OS maps files onto physical media and accesses files via the devices that control the physical media
OS is responsible for:
File creation and deletion.
Directory creation and deletion.
Supporting primitives for manipulating files and directories.
Mapping files onto secondary storage.
Backing up files on nonvolatile storage media
File protection: who can access a file in what ways
Ch11, Ch12
I/O-System Management
Manage and control I/O operations and I/O devices
The I/O subsystem consists of:
A general device-driver interface
Drivers for specific hardware devices
Buffering, caching, and spooling
Ch13 (skip)
Secondary-Storage Management
The operating system is responsible for:
Free space management
Storage allocation
Disk scheduling
Ch14 (skip)
Networking
Processors in a distributed system are connected through a communication network.
Communication among processors takes place using a set of protocols implemented by OS.
Ch15 - Ch17
Protection System
Protection refers to a mechanism for controlling access by processes or users to system resources.
Ch18
Command-Interpreter System
Command interpreter (or shell): get the next command statement and execute it
Graphical shell: Microsoft Windows and Mac OS
Command-line shell: UNIX
Can be part of kernel or just an application program
System Calls
System calls provide the interface between a process and the operating system.
Usually available as assembly-language instructions.
Some languages allow system calls to be made directly (e.g., C, C++)
Three methods to pass parameters to OS:
Pass parameters in registers.
Store the parameters in a table in memory, the table address is passed as a parameter in a register.
Parameters are pushed onto the stack by the program, and popped off the stack by operating system
Categories of System Calls
Process control: load & execute, create, end, abort, get/set process attributes, wait, etc.
File management: open, close, create, delete, read, write, reposition, get/set file attributes, etc.
Device management: request, release, read, write, reposition, get/set file attributes, etc.
UNIX: devices handled as virtual files, identified by special file names
Information maintenance: get/set time or date, get/set system data, get/set process/file/device attributes, etc.
Communications: open/close connection, send/receive message, etc.
Communication Models
Message-passing model: processes exchange info though an interprocess-communication facility provided by OS
Open connection before communication
Communication done by exchanging messages
Close connection after communication
Easier to implement for intercomputer communication
Shared-memory model: processes exchange info by reading/writing data in shared areas in memory
Fast and convenient within a computer
Must ensure processes do not write to the same location simultaneously
System Programs
System programs provide a convenient environment for program development and execution.
Categories of system programs:
File management: cp, ls, rm
Status information: df, date
File modification: vi, pico, emacs
Programming language support: compilers, assemblers,interpreters
Program loading and execution: linkers, loaders, debuggers
Communications: web browsers, email, remote login
System programs define the user interface
Shell
A system program that gets and executes the next user specified command
Two ways to implement commands
Shell contains the code to execute the command
Size of shell determined by number of commands
Difficult to add a new command
Commands are system programs
+ Shell can be small
+ Can easily add commands
- Slower
- Need pass parameters from shell to the system program
- Interpretation of parameters may be inconsistent
Unix: some commands are built in, the rest are system programs
System Structure
Simple structure
MS-DOS, Unix
Layered approach
Windows NT, OS/2
Microkernels
Mach, MacOS X server
UNIX System Structure
OS consists of two parts:
System programs
The kernel
Consists of everything below the system-call interface and above the physical hardware
Provides the file system, CPU scheduling, memory management, I/O, etc.
A large number of functions in one leveldifficult to enhance
Layered Approach
The operating system is divided into a number of layers
The bottom layer (layer 0) is the hardware
The highest (layer N) is the user interface
Each layer uses functions and services of only lower-level layers.
Benefits:
Simplify debugging and system verification: can debug one layer at a time
Can change the implementation of a layer without affecting other layers, provided that the interface and functions of the layer do not change
Problems:
Design of layers can be tricky
Less efficient: each layer may add overhead to a system call
Microkernel System Structure
Remove all non-essential components from kernel, implementing them as services run in user space
Usually, microkernel provides:
Minimal process and memory management
Communication facility
Communication between client program and various services provided by message passing
System calls become messages sent via kernel to appropriate service
Benefits:
Adding services doesn’t require kernel modification
Kernel codifications simpler when required
More secure: less code is running in kernel mode
More reliable: kernel OK when a service fails
Examples: Mach, MacOS X server
Friday, November 16, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment