Operating System CS205: 1st April 2019 by
Operating System CS205: 1st April 2019 by
CS205
Lecture 9
CPU Scheduling
1st April 2019
Dispatch
Admit Release
Blocked
4. A Process
terminates
9 CS-205 Operating System
Non Preemptive Scheduling
Once the CPU has been allocated to a process
The process keeps it until
It Terminates
Or has to wait for:
I/O
Mutex
Child process
Semaphore
Conditional Variables etc
There is no way, to get the CPU back, FORCEFULLY
Dispatch
Admit Release
Blocked
4. A Process
terminates
11 CS-205 Operating System
Preemptive Scheduling
Possible to get the CPU back from a process, even if the
process has not completed its execution.
Dispatch
Admit Release
Turnaround Time
How long it take to execute a Process
Turnaround = Completion_Time
– Submission_Time
Turnaround = Wait_TimeGetIntoMemory
+ Wait_TimeReadyQueue
+ Wait_TimeBlockQueue
+ CPU_Execution_Time
0 24 27 30
Waiting time for P1 = 0; P2 = 24; P3 = 27
Average waiting time: (0 + 24 + 27)/3 = 17
P2 P3 P1
0 3 6 30
time
5 10 15 20 25
P1 P3 P2 P4
0 3 7 8 12 16
P1 P2 P3 P2 P4 P1
0 2 4 5 7 11 16