Which scheduling algorithm gives a minimum average waiting time?
![Which scheduling algorithm gives a minimum average waiting time?](/img/relate-questions.png)
A. SJF
B. Priority
C. FCFS
D. RR
Please scroll down to see the correct answer and solution guide.
Right Answer is: A
SOLUTION
Consider the following schedule:
Process ID |
Arrival time |
Burst time |
P1 |
0 |
2 |
P2 |
1 |
3 |
P3 |
2 |
6 |
P4 |
3 |
4 |
Gantt chart: FCFS
0 2 5 9 15
P1 |
P2 |
P4 |
P3 |
Average waiting time for FCFS = 2.75
Gantt chart: SJF
0 2 5 9 15
P1 |
P3 |
P2 |
P4 |
Average waiting time for SJF = 2.5
Gantt chart: Priority scheduling:
Consider highest priority of the one having highest burst time
0 2 8 12 15
P1 |
P3 |
P4 |
P2 |
Average waiting time in this case = 4
Round – robin scheduling:
Consider time quantum = 2 units
0 2 4 6 8 9 11 13 15
P1 |
P2 |
P3 |
P4 |
P2 |
P3 |
P4 |
P3 |
Average waiting time in this case = 4.5
So, from given options SJF will give minimum average waiting time.