The following table shows the processes in the ready queue and time required for each process for completing its job.
Process Time P1 10 P2 5 P3 20 P4 8 P5 15
If round-robin scheduling with 5 ms is used what is the average waiting time of the processes in the queue?
(A) 27 ms
(B) 26.2 ms
(C) 27.5 ms
(D) 27.2 ms
Explanation: The Gantt chart for the processes is shown:
Waiting time of a process = Sum of the periods spent waiting in the ready queue.
Waiting time = completion time - burst time Waiting time of P1 = 30 -10 = 20 Waiting time of P2 = 10 - 5 = 5 Waiting time of P3 = 58 - 20 = 38 Waiting time of P4 = 38 - 8 = 30 Waiting time of P5 = 53 - 15 = 38 Average waiting time = 20 + 5 + 38 + 30 + 38 =131/5 = 26.2
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.