Professional Documents
Culture Documents
3 4
System Implementation System Design Goals
Once written in assembly language, operating User goals – operating system should be
systems are now written in higher-level languages convenient to use, easy to learn, reliable,
Code written in a high-level language: safe, and fast
– Can be written faster
– Is more compact.
System goals – operating system should be
– Is easier to understand and debug easy to design, implement, and maintain, as
An operating system is far easier to port (move to well as flexible, reliable, error-free, and
some other hardware) if it is written in a high-level efficient
language
5 6
System Components OS kernel
Process management The kernel of the OS is the portion providing privileged high
priority functions.
Memory management – Dispatcher
– Interrupt handling
File management
– I/O control
I/O management – Memory management
Some parts of the operating system do not reside in the kernel.
Security manager
Shell It is the main component of most computer operating systems;
OR it is a bridge between applications and the actual data
processing done at the hardware level.
– The kernel's responsibilities include managing the system's resources (the
communication between hardware and software components).
7 8
Microkernel System Structure Microkernel System Structure
Moves as much from the kernel into “user” Benefits:
space – Easier to extend a microkernel
– Easier to port the operating system to new architectures
Communication takes place between user – More reliable (less code is running in kernel mode)
modules using message passing – More secure
Detriments:
– Performance overhead of user space to kernel space
communication
The overhead of user space to kernel 9 10
11 12
Shell Features Human Interface
Reads user input and executes programs. The shell is the part of the OS that is most
Provides the prompt. important to most users.
Implements redirection Considerable effort has gone into trying to
Implements parallel execution with ‘&’
make the interface intuitive and easy to use
May implement simple commands
Shells may provide a graphical user interface
13 14
Popular Shells Shell Outline
command.com in DOS do forever
{
C shell in Unix print prompt;
Korn shell in Unix read command;
if (fork()==0)
Borne shell in Unix
{ // child process
explorer.exe – Windows user interface use exec() to load program;
Cygwin – Unix shell for Windows }
wait for child process to terminate;
}
15 16
execv function Member functions of Process.h
where:
– cmdname is the name of the program file.
– argv is an array of pointer to strings containing the parameters.
By convention argv[0] = cmdname; The last argv entry must be NULL.
19 20
Example Multiple Processes Shell Outline
makefile bigthing & do forever
{
print prompt;
xterm & read command;
if (fork()==0)
{ // child process
ls & cc myprog.c use exec() to load program;
}
if (no “&”)
ls & cc myprog.c & ps wait for child to terminate;
}
21 22
Scripts Utilities
The shell can execute script files to produce An operating system is more than just the kernel,
commands for the shell. there are many utilities.
Scripts are a program whose output is a series of The utilities are just user applications.
commands to the shell. Different user interfaces require different utilities
DOS batch files are a simple example of scripting.
Unix scripts can be much more elaborate.
23 24
DOS Commands Unix Commands
25 26
Windows Utilities Process Management
A process is a program in execution
– A process needs certain resources, including CPU time,
memory, files, and I/O devices, to accomplish its task
The operating system is responsible for the following
activities in connection with process management
creation, deletion
suspension, resumption
synchronization, communication
27 28
Main-Memory Management File Management
Memory is a large array of words or bytes, each with The operating system is responsible for the
its own address following activities in connections with file
RAM is a volatile storage device. It loses its contents management:
without power.
– File creation and deletion
The operating system is responsible for the following
– Directory creation and deletion
activities in connection with memory management
– Keep track of which parts of memory are currently being used and – Support of primitives for manipulating files and
by whom directories
– Decide which processes to load when memory space becomes – Mapping files onto secondary storage
available
– Allocate and de-allocate memory space as needed
29 30
Secondary-Storage Management I/O System Management
Since RAM is volatile and too small to accommodate The I/O system consists of:
all data and programs permanently, the computer – A buffer-caching system
system must provide secondary storage to back up
– A general device-driver interface
main memory
– Drivers for specific hardware devices
Most modern computer systems use disks as the
primary on-line storage medium, for both programs
and data
The operating system is responsible for:
– Free space management
– Storage allocation
– Disk scheduling
31 32
Security manager OS Services
The Security manager provides a mechanism for Program Execution
controlling access by programs, processes, or users
I/O control
to both system and user resources
The protection mechanism must: Communications
– distinguish between authorized and unauthorized usage Error detection
– specify the controls to be imposed
Resource allocation
– provide a means of enforcement
Protection
33 34
Supervisor Calls Virtual Machines
Supervisor Calls (SVC) are a means of making a A virtual machine takes the layered approach to its
function call to an OS service. logical conclusion. It treats hardware and the
operating system kernel as though they were all
The normal function call mechanism will not work
hardware
since you have to change to the OS environment. A virtual machine provides an interface identical to
the underlying bare hardware
The operating system creates the illusion of multiple
An SVC or INT call generates an interrupt. The OS
gets control and executes the desired function. processes, each executing on its own processor with
its own (virtual) memory
35 36
Advantages/Disadvantages
Virtual Machines (Cont.) of Virtual Machines
The resources of the physical computer are shared to The virtual-machine concept provides
create the virtual machines complete protection of system resources
– CPU scheduling can create the appearance that users have
their own processor
since each virtual machine is isolated from all
– Spooling and a file system can provide virtual card readers other virtual machines. This isolation,
and virtual line printers however, permits no direct sharing of
– A normal user time-sharing terminal serves as the virtual resources.
machine operator’s console
37 38
Pros / Cons of Virtual Machines System Generation (SYSGEN)
A virtual-machine system is a perfect vehicle for Older OS had to be recompiled whenever you
operating-systems research and development. made a configuration change.