OPERATING SYSTEM OVERVIEW
description
Transcript of OPERATING SYSTEM OVERVIEW
OPERATING SYSTEM
OVERVIEW
ContentsContents
Basic hardware elements
Most I/O devices
are much slower than
the processor
InterruptsInterrupts
Interrupt request signal
Active waiting cycle
(polling)
An interrupt cycle is added to the
instruction cycle (fecth and execute).
The processor checks to
see if an interrupt has
occured (interrupt signal)
Interrupt mechanismInterrupt mechanism
interrupt handler
interrupt vector
Interrupt mechanismInterrupt mechanism
CPU saves PS and PC (push) into the
control stack
CPU saves PS and PC (push) into the
control stack
CPU loads into PC and
PS the corresponding values from the
interrupt vector
CPU loads into PC and
PS the corresponding values from the
interrupt vector
Interrupt processingInterrupt processing
iretiret
interrupt handler
execution
interrupt handler
execution
Interrupt processingInterrupt processing
Interrupt enable/disable bit (PS register)Interrupt enable/disable bit (PS register)
Hardware priority
Hardware priority
STI (Set Interrupt) CLI (Clear
Interrupt)
STI (Set Interrupt) CLI (Clear
Interrupt)
Interrupt mechanismInterrupt mechanism
main memorymain memory
i+1i+1 PS inth
1OOii1OO1OO
149149
15O15O iretiret
1OOO1OOO
12OO12OO
12O112O1
main memorymain memory
inthinth
progproginterruptinterrupt
11
22
33
interrupt vectorinterrupt vector
Interrupt processing
PS prog
12O1
3824
PSPS
PCPC
SPSP
stack
main memory
38243824
39OO39OO
CPU completes execution
of the current instruction
CPU completes execution
of the current instruction
Interrupt processing
interrupt signal has been acceptedinterrupt signal has been accepted
PS inth
1OO
3822
PSPS
PCPC
SPSP
stack
main memorymain memory
38243824
39OO39OO
12O1
PS prog
38233823
38223822
Interrupt processing
PS inth
151
3822
PSPS
PCPC
SPSP
stack
main memorymain memory
38243824
39OO39OO
12O1
PS prog
38233823
38223822
iret executioniret execution
Interrupt processing
stack
main memorymain memory
38243824
39OO39OO
PS prog
12O1
3824
PSPS
PCPC
SPSP
iret completed iret completed
Interrupt processing
O.S.Components
ContentsContents
Process Management
O.S. COMPONENTS
Main-Memory Management
Secondary-Memory
Management
File Management
I/O-System Management
O.S. COMPONENTS
Creating and deleting processes
Suspending and resuming processes
Provide mechanisms
for process interaction
Process management
Keeping track of which
parts of memory
are currently being used
and by whom
Main memory management
Deciding which processes are to be loaded
when memory becomes available
Main memory management
Allocating and deallocating memory
space as needed
Main memory management
Secondary memory
management
Free space management
Storage allocation
Disk scheduling
I/O SYSTEM MANAGEMENT
The I/O subsystem
consists of
A memory-management component that
includes buffering and spooling
A general device driver interface
Drivers for specific hardware devices
A general device driver interface
Drivers for specific hardware devices
I/O SYSTEM MANAGEMENT
The I/O subsystem
consists of
I/O SYSTEM MANAGEMENT
The I/O subsystem
consists of
File management
Creating and deleting
files and directories
Supporting primitives
for manipulating file
and directory
Mapping files
onto storage
Backing up files
on stable storage media
File management
Protection systemsProtection systems
Mechanism for
controlling the access
of processes to system resources
The mechanism must
provide means for specifying the
controls
to be imposed and means for enforcement
Protection systems
The interface between users and O.S.
A program that reads
and interpretes control statements
The interface between users and O.S.
A program that reads
and interpretes control statements
Comand-Interpreter System
Its main function: to get next command
statement
and execute it (shell)
Its main function: to get next command
statement
and execute it (shell)
Comand-Interpreter System
System calls
ContentsContents
Processes communicate
with the O.S. and request services to it by
making system calls
System Calls
System calls provide
the interface between any process and O.S.
System Calls
Process control
Examples of System CallExamples of System Call
Communications
Information management
Device manipulation
File manipulation
Corresponding to
each system call
there is a library procedure
Corresponding to
each system call
there is a library procedure
count= read (file, buffer, nbytes)
count returns the number of bytes actually read
C programC program
Example: read system callExample: read system call
Library read
procedure
operating system
system call READ
INT
return from INT
register xregister x
x call parameters
load x
system call READ 2
3
1
Puts the parameters of the system call in machine
registers
Puts the parameters of the system call in machine
registers
The library procedureThe library procedure
The control is returned to the caller by
returning the status code as a result
The control is returned to the caller by
returning the status code as a result
Issues a INT instruction to start the O.S.
Issues a INT instruction to start the O.S.
directly via registers
in a memory block whose address is passed as a
parameter in a registry
into the stack (push, pop)
directly via registers
in a memory block whose address is passed as a
parameter in a registry
into the stack (push, pop)
Methods to pass parameters to operating systemMethods to pass parameters to operating system
hardware
(CPU, memory, disks, terminals, …)
UNIX O.S.
(process management, memory management, file system,
I/O, ...)
standard library
(open, close, read, write, ..)
utility programs
(shell, compiler, …)
users
user mode
kernel mode
user int.
library
interface
system
call
interf.
Dual mode of operationsDual mode of operations
user modeuser mode
Hardware control does not allow the execution of
privileged instructions
Hardware control does not allow the execution of
privileged instructions
Used for normal execution of user programs
Used for normal execution of user programs
Used for the execution of O.S. functions as
required by system calls
Used for the execution of O.S. functions as
required by system calls
supervisor mode (kernel mode)supervisor mode (kernel mode)
All instructions can be executed
All instructions can be executed
Dual mode of operationsDual mode of operations