All mock tests are FREE till 31 December — register to save your progress

Consider the following arrival and burst times for three processes P0, P1, P2. The pre-emptive shortest job first algorithm is used, and scheduling is carried out only at the arrival or completion of a process. What is the average waiting time for the three processes?
ProcessArrival timeBurst time
P00 ms7
P11 ms3
P22 ms7

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. 3.67 ms

Explanation

P0 runs 0–1 (6 left). P1 arrives with 3 and preempts it, running 1–4 (at 2, P2's 7 is longer). At 4, P0 (6) beats P2 (7): P0 runs 4–10, then P2 10–17. Waiting: P0 = 10 − 7 = 3, P1 = 0, P2 = 17 − 2 − 7 = 8. Average = 11/3 ≈ 3.67 ms.

More System Software and Operating System questions