Last Updated : 06 Dec, 2018

Consider the following process and find 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) 17.5 ms
(B) 20 ms
(C) 25 ms
(D) 14 ms


Answer: (D)

Explanation: According to the longest remaining time first (preemptive) algorithm processes are scheduled as following below:
\"\"
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
And average waiting time = 70 / 5 = 14 ms.

So, option (D) is correct.

Quiz of this Question


Share your thoughts in the comments