-
Consider the set of processes with arrival time (in milliseconds). CPU burst time (in milliseconds) and priority (0 is the highest priority) shown below. None of the processes have I/O burst time.
Process Arrival Time Burst Time Priority P1 0 11 2 P2 5 28 0 P3 12 2 3 P4 2 10 1 P5 9 16 4
The average waiting time (in milliseconds) of all the processes using preemptive priority scheduling algorithm is ________.
-
- 9 ms
- 11 ms
- 19 ms
- 29 ms
Correct Option: D
Gantt chart for above problem looks like:
Waiting Time = (Completion time – Arrival time – Burst time).
∑AT = (0 + 5 + 12 + 2 + 9) = 28
∑BT = (11 + 28 + 2 + 10 + 16) = 67
∑CT = (67 + 51 + 49 + 40 + 33) = 240
Waiting time = (240 – 28 – 67) = 145
Average Waiting time = | = 29 ms | |
5 |
Hence, 29 ms is correct answer.