Operating Systems 3
Operating Systems 3
Operating Systems 3
Lecture 3
OS Components
Process management
Main memory management
Secondary storage management
I/O system management
File management
Protection system
Networking
Command-line interpreter (shells)
2
Operating System Services
Interrupt Trap
System Calls
User processes must not be given open
access to the kernel code
The system call interface layer contains
entry point in the kernel code
Any user or application request that
involves access to any system resource
must be handled by the kernel code
Types Of System Calls
Process Control
File Management
Device Management
Information maintenance
Communications
System Call Execution
The user program makes a call to a library function.
Library routine puts appropriate parameters at a well-
known place (registers, stack, or a table in memory).
The trap instruction is executed to change mode from
user to kernel.
Control goes to operating system.
Operating system determines which system call is to be
carried out.
Semantics of System Call
Execution …
Kernel indexes the dispatch table, which contains
pointers to service routines for system calls.
Service routine is executed and return parameter or
error code placed at well-known places (usually a CPU
register).
Control given back to user program.
Library function executes the instruction following
trap.
System Call …
Process
Library Call
System Call
trap
Dispatch Table
Service
Code
Kernel
Code
Operating System
Structures
Simple Structure
Layered Approach
Microkernels
Virtual Machines
Simple Structures
MS-DOS : written to provide the most functionality in the least
space, so it was not divided into modules carefully
Simple Structures …
UNIX consists of two separable parts, the
kernel and the system programs.
Every thing below the system call interface
and above the physical hardware is the
kernel.
An enormous amount of functionality
combined in one level, UNIX is difficult to
enhance as changes in one section could
adversely affect other areas.
UNIX System Structure
Layered Approach
The OS is broken up into a number of
layers
Bottom layer is hardware and the topmost
layer ( layer N) is the user interface
A typical layer consists of data structures
and a set of routines to service the layer
above it
THE operating system by Dijkstra
IBM’s OS/2
Layered Approach …
Modularity
Each layer uses functions and services of
only lower layers
Simplifies debugging and system
verification.
The major difficulty with layered approach
is careful definition of layers, because a
layer can only use the layers below it
Less efficient than other approaches
Microkernel
Structures the operating system by
removing all non-essential components
from the kernel and implementing them as
system and user level programs
Smaller kernel
Main function is to provide a
communication facility between client
programs and the various services that are
also running in the user space.
Microkernel …
Easier to extend the OS—new services are
added to user space and consequently do not
require modification of the kernel and/or its
recompilation
Easier to maintain operating system code
(enhancement, debugging, etc.)
OS is easier to port from one hardware to
another
More security and reliability
Mach, MacOS X Server,OS/2, and Windows
NT