Download presentation
Presentation is loading. Please wait.
1
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972
2
§Completion of I/O triggers an interrupt §Hardware Trap: l Division by zero l Invalid memory access §Request for OS service l Trap/System call/Monitor call
3
Protection §Dual Mode Operation l User mode l Kernel mode §Mode bit (0/1) (MS-DOS did not have it) §System call (switches from user mode to kernel mode) §Privileged instructions should be executed in kernel mode only
4
Protection §Changing mode bit?
5
I/O Protection §User cannot issue I/O instructions directly §Changes to interrupt vector?
6
Memory Protection
8
§Changes to base and limit registers?
9
CPU Protection §E.g. Infinite loop executed by a process
10
CPU Protection §Timer handler?
11
Process :Program in execution Associated state (PC, SP, registers etc) Address space
12
Processes The Process Model §Multiprogramming of four programs §Conceptual model of 4 independent, sequential processes §Only one program active at any instant Logical program counter Execution order not reproducible
13
Process creation System initialization User request to create a new process
14
Process Termination Conditions which terminate processes 1.Normal exit (voluntary) 2.Error exit (voluntary) 3.Fatal error (involuntary) 4.Killed by another process (involuntary)
15
Process Hierarchies §Parent creates a child process, child processes can create its own process §Forms a hierarchy l UNIX calls this a "process group" §Windows has no concept of process hierarchy l all processes are created equal
16
§As a process executes, it changes state l new: The process is being created l running: Instructions are being executed l waiting: The process is waiting for some event to occur l ready: The process is waiting to be assigned to a processor l terminated: The process has finished execution
17
Process States ps in Unix Background processes
18
Process Control Block (PCB)
19
CPU Switch From Process to Process
20
Process Scheduling Queues §Job queue – set of all processes in the system §Ready queue – set of all processes residing in main memory, ready and waiting to execute §Device queues – set of processes waiting for an I/O device §Processes migrate among the various queues
21
Ready Queue And Various I/O Device Queues
22
Representation of Process Scheduling
23
§I/O parallelism: l overlap execution: make 1 CPU into many l (Real parallelism: > 1 CPU (multiprocessing)) §Completion time: l B’s completion time = 100s (A + B) So overlap Why processes? Speed emacs (Wait for input) gcc A B A B 20 s80 s Completion time for B? A? 10 s
24
Context Switch §When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process §Context-switch time is overhead; the system does no useful work while switching §Time dependent on hardware support
26
Passing of Parameters As A Table
27
Process Creation (Cont.) §Address space l Child duplicate of parent l Child has a program loaded into it §UNIX examples l fork system call creates new process l exec system call used after a fork to replace the process’ memory space with a new program
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.