CPU Scheduling Algorithms
CPU Scheduling Algorithms
Algorithms
CPU scheduling
4. Throughput should be Maximum - i.e. Number of processes that complete their execution per
5. Minimum turnaround time - i.e. time taken by a process to finish execution should be the least.
waiting time and the process should not starve in the ready queue.
7. Minimum response time - time when a process produces the first response should be as little as
CPU Scheduling Criteria
Non- Pre-emptive Scheduling
First Come First Serve (FCFS)
P1 3 4
P2 5 3
P3 0 2
P4 5 1
P5 4 3
P1 7 7–3=4 4–4=0
P2 13 13 – 5 = 8 8–3=5
P3 2 2–0=2 2–2=0
P4 14 14 – 5 = 9 9–1=8
P5 10 10 – 4 = 6 6–3=3
Average Turn Around time = (4 + 8 + 2 + 9 + 6) / 5 = 29 / 5 = 5.8 unit
Average waiting time = (0 + 5 + 0 + 8 + 3) / 5 = 16 / 5 = 3.2 unit
Shortest Job Next (SJN)
• The processer should know in advance how much time process will take.
Priority Based Scheduling
• Processes with same priority are executed on first come first served basis