Last Updated : 06 Dec, 2018

Consider the following process and calculate the average waiting time when the longest remaining time first(preemptive)scheduling algorithm is applied:

Process ID Arrival Time Bust Time
P0 2 1
P1 4 4
P2 5 4
P3 8 10
P4 10 11


All time is in milli seconds.
(A) 20 ms
(B) 18 ms
(C) 16 ms
(D) 14 ms


Answer: (D)

Explanation: According to the longest remaining time first(preemptive) algorithm processes are scheduled:
\"\"
Waiting time = Turn around time – burst time
Turn around time = Completion time – arrival time

Process ID Arrival Time Bust Time Turn around Time Waiting Time
P0 2 1 1 0
P1 4 4 26 22
P2 5 4 26 22
P3 8 10 24 14
P4 10 11 23 12


Average waiting time = summation of all processes waiting time / number of processes
Average waiting time = 70 / 5 = 14 ms.

Quiz of this Question


Share your thoughts in the comments