Feleke OS Lecture 4 (CPU Scheduling)
Feleke OS Lecture 4 (CPU Scheduling)
Preemptive Scheduling
Process can be interrupted and must release the CPU.
Need to coordinate access to shared data
4. Terminates
Dispatch Latency:
time it takes for the dispatcher to stop one process and
start another running.
Dispatcher must be fast.
Maximize Throughput
Pre-emptive
Priority
Round-Robin
P1 P3 P2 P4 P1 P2 P3 P2 P4 P1
0 7 8 12 16 0 2 4 5 7 11 16
= 1
n+1 = tn; Only the actual last CPU burst counts.
(1-)^(n+1) 0
Each successive term has less weight than its predecessor.
Nonpreemptive
P1 10 2
Required: P2 5 1
a) Draw four Gantt charts illustrating the
P3 14 5
execution of these processes using:
P4 20 4
i. FCFS,
P5 5 3
ii. SJF (non-preemptive case),
iii. Priority (a smaller priority number implies a higher priority), and
iv. Round-Robin (quantum = 5ms) scheduling.
b) Find the turnaround time of each process for each of the scheduling algorithms in part a?
c) Find the waiting time of each process for each of the scheduling algorithms in part a?