7/18/2019 Boot Sequence
1/11
1
OS Structure,
Processes & Process Management
7/18/2019 Boot Sequence
2/11
2
Recap
OS functions Coordinator
Protection Communication Resource management
Service provider File system, device handler,
Questions: Ho can the OS perform these functions! Ho is an OS invo"ed! #hat is the structure of the OS!
7/18/2019 Boot Sequence
3/11
3
An Operating System in Action
CP$ loads %oot program from RO& 'e(g( )*OS in PC+s
)oot program: -.amines/chec"s machine configuration 'num%er of CP$+s, ho
much memory, num%er 0 type of hardare devices, etc( )uilds a configuration structure descri%ing the hardare 1oads the operating system, and gives it the configuration
structure
Operating system initiali2ation: *nitiali2e "ernel data structures
*nitiali2e the state of all hardare devices Creates a num%er of processes to start operation 'e(g( getty in
$3*4, the #indoing system in 35, e(g(
7/18/2019 Boot Sequence
4/11
4
O.S. in Action (Contd)
6fter %asic processes have started, the OS runs user
programs, if availa%le, otherise enters the idle loop
*n the idle loop: OS e.ecutes an infinite loop '$3*4 OS performs some system management 0 profiling OS halts the processor and enter in lo7poer mode
'note%oo"s
OS a"es up on: *nterrupts from hardare devices -.ceptions from user programs System calls from user programs
5o modes of e.ecution $ser mode: Restricted e.ecution mode 'applications Supervisor mode: $nrestricted access to everything 'OS
7/18/2019 Boot Sequence
5/11
5
Control Flow in an OS
Operating System &odules
*dle1oop
From %oot
*nitiali2ation
R5*
*nterruptSystem call
main'
-.ception
Supervisor &ode
Return touser mode
7/18/2019 Boot Sequence
6/11
6
On Interrupts
Hardare calls the operating system at a pre7specifiedlocationOperating system saves state of the user programOperating system identifies the device and cause ofinterrupt
Responds to the interruptOperating system restores state of the user program 'ifapplica%le or some other user program-.ecute an R5* instruction to return to the user program$ser program continues e.actly at the same point it as
interrupted(
8ey Fact: 3one of this is visi%le to the user program
7/18/2019 Boot Sequence
7/117
On Exceptions
Hardare calls the operating system at a pre7specifiedlocationOperating system identifies the cause of the e.ception 'e(g(divide %y 9*f user program has e.ception handling specified, then OS
adust the user program state so that it calls its handler-.ecute an R5* instruction to return to the user program*f user program did not have a specified handler, then OS"ills it and runs some other user program, as availa%le
8ey Fact: -ffects of e.ceptions are visi%le to user programsand cause a%normal e.ecution flo
7/18/2019 Boot Sequence
8/118
On System Calls
$ser program e.ecutes a trap instruction 'system callHardare calls the operating system at a pre7specifiedlocationOperating system identifies the re;uired service andparameters 'e(g( open'filename, O
Operating system e.ecutes the re;uired serviceOperating system sets a register to contain the result ofcall-.ecute an R5* instruction to return to the user program$ser program receives the result and continues
8ey Fact: 5o the user program, it appears as a function calle.ecuted under program control
7/18/2019 Boot Sequence
9/119
Operating System
(process/device/memory management,
file systems, interprocess communication, )
Operating System
(process/device/memory management,
file systems, interprocess communication, )
Operating System oday!ig"#le$el so%tware arc"itecture
MemoryMemory
Instruction Execution & Interrupt ProcessingInstruction Execution & Interrupt Processing
User ApplicationsUser Applications
Window
System
Window
SystemCommand
Interpreter
Command
Interpreter
I/O DevicesI/O Devices
MiddlewareMiddleware
7/18/2019 Boot Sequence
10/1110
Operating System Structures
&onolithic OS 'e(g(, $ni. &icro7"ernel OS 'e(g(,&ach, -.o"ernel,
Memory ManagementMemory Management
CPU SchedulingCPU Scheduling
Process ManagementProcess Management
HardwareHardware
Network SupportNetwork Support
SecuritySecurity
File SystemFile System
Command InterpreterCommand Interpreter
Device ManagementDevice Management
NetworkSupport
NetworkSupport
MemoryMgmt.
MemoryMgmt.
WindowServer
WindowServer
FileServerFile
Server
......
HardwareHardware
CPUScheduling
CPUScheduling
Device
Drivers
Device
DriversInterrupt
Handler
Interrupt
HandlerBoot and
Init.
Boot and
Init.
Message PassingMessage Passing
APIAPI
7/18/2019 Boot Sequence
11/1111
Summary
6n OS is ust a program: *t has a main' function, hich gets called only once 'during
%oot 1i"e any program, it consumes resources 'such as memory, can
do silly things 'li"e generating an e.ception, etc(
)ut it is a very strange program: *t is ?entered@ from different locations in response to e.ternal
events *t does not have a single thread of control, it can %e invo"ed
simultaneously %y to different events 'e(g( system call 0 aninterrupt
*t is not supposed to terminate *t can e.ecute any instruction in the machine
Top Related