3.basic hardware elements.pdf
-
Upload
freedomball -
Category
Documents
-
view
225 -
download
0
Transcript of 3.basic hardware elements.pdf
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 1/41
OPERATING SYSTEMOVERVIEW
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 2/41
Contents
Basic hardware elements
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 3/41
!Most I/O devices
are much slower thanthe processor
Interrupts
!Interrupt request signal
!Active waiting cycle(polling)
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 4/41
! An interrupt cycle isadded to the instruction
cycle (fecth and execute).! The processor checks tosee if an interrupt hasoccured (interrupt signal)
Interrupt mechanism
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 5/41
! interrupt handler
! interrupt vector
Interrupt mechanism
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 6/41
! CPU saves PS and PC(push) into the control
stack
! CPU loads into PC andPS the corresponding
values from theinterrupt vector
Interrupt processing
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 7/41
!iret
!interrupt handler
execution
Interrupt processing
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 8/41
Interrupt enable/disablebit (PS register)
!Hardware priority
!STI (Set Interrupt)CLI (Clear Interrupt)
Interrupt mechanism
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 9/41
main
ain
memory
emory
i+1 PS inth
1OO
OO
149
15O
iret
1OOO
12OO
12O1
main
ain
memory
emory
inth
nth
progrog
interrupt
nterrupt
1
2
3
interrupt
nterrupt
vector
ector
Interrupt processing
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 10/41
PS prog
12O1
3824
PS
PC
SP
stack
main
memory
3824
39OO
CPU completes execution
of the current instruction
Interrupt processing
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 11/41
interrupt signal has beenaccepted
PS inth
1OO
3822
PS
PC
SP
stack
main
ain
memory
emory
3824
39OO
12O1
PS prog
3823
3822
Interrupt processing
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 12/41
PS inth
151
3822
PS
PC
SP
stack
main memory
ain memory
3824
39OO
12O1
PS prog
3823
3822
iret execution
Interrupt processing
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 13/41
stack
main
memory
3824
39OO
PS prog
12O1
3824
PS
PC
SP
iret completed
Interrupt processing
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 14/41
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 15/41
!Process Management
O.S. COMPONENTS
!Main-Memory Management
!Secondary-MemoryManagement
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 16/41
!File Management
!I/O-System Management
O.S. COMPONENTS
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 17/41
! Creating and deletingprocesses
! Suspending and resumingprocesses
! Provide mechanisms
for process interaction
Process management
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 18/41
Keeping track of which
parts of memoryare currently being usedand by whom
Main memory management
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 19/41
Deciding which processes
are to be loaded whenmemory becomes available
Main memory management
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 20/41
Allocating and
deallocating memoryspace as needed
Main memory management
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 21/41
Secondary memorymanagement
! Free space management! Storage allocation
! Disk scheduling
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 22/41
I/O SYSTEM MANAGEMENT
The I/O subsystemconsists of
! A memory-managementcomponent that includesbuffering and spooling
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 23/41
! A general device driverinterface
! Drivers for specific
hardware devices
I/O SYSTEM MANAGEMENT
The I/O subsystemconsists of
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 24/41
File management
! Creating and deleting
files and directories! Supporting primitives
for manipulating fileand directory
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 25/41
! Mapping files
onto storage! Backing up files
on stable storage media
File management
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 26/41
Protection systems
! Mechanism for
controlling the accessof processes to systemresources
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 27/41
! The mechanism must
provide means forspecifying the controlsto be imposed and meansfor enforcement
Protection systems
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 28/41
! The interface betweenusers and O.S.
! A program that readsand interpretes controlstatements
Comand-Interpreter System
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 29/41
! Its main function: to get
next command statementand execute it (shell)
Comand-Interpreter System
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 30/41
System calls
Contents
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 31/41
Processes communicate
with the O.S. and requestservices to it by makingsystem calls
System Calls
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 32/41
System calls provide
the interface between anyprocess and O.S.
System Calls
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 33/41
!Process control
Examples of System Call
!Communications
!Information management
!Device
manipulation
!File manipulation
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 34/41
Corresponding to
each system call
there is a library procedure
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 35/41
count= read file, buffer,
nbytes)
count returns the number of bytes
actually read
C program
Example:xample: readead system callystem call
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 36/41
Library read
ibrary read
procedurerocedure
operating
perating
systemystem
system call
READ
INT
NT
return
eturn
from INT
rom INT
register x
x call
parameters
load x
system call
READ
2
3
1
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 37/41
" Puts the parameters of the
system call in machine
registers
The library procedure
he library procedure
" The control is returned to
the caller by returning the
status code as a result
" Issues a INT instruction to
start the O.S.
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 38/41
" 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 system
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 39/41
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.
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 40/41
Dual mode of operations
user mode
" Hardware control does not
allow the execution of
privileged instructions
" Used for normal execution of
user programs
8/19/2019 3.basic hardware elements.pdf
http://slidepdf.com/reader/full/3basic-hardware-elementspdf 41/41
"" Used for the execution of
sed for the execution of
O.S. functions as required
.S. functions as required
by system calls
y system calls
supervisor mode kernel mode)
"" All instructions can be
ll instructions can be
executedxecuted
Dual mode of operations