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

Consider the following three processes, with arrival time and CPU burst time in milliseconds: P1 (arrival 0, burst 7), P2 (arrival 1, burst 4), P3 (arrival 2, burst 8). The Gantt chart for the preemptive SJF scheduling algorithm is

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

Show answer & explanation

Correct answer: B.

Option B

Explanation

P1 starts at 0. At t = 1, P2 (4) is shorter than P1's remaining 6, so it pre-empts and runs 1–5. Then P1 (6) beats P3 (8), running 5–11, and P3 runs 11–19: chart B.

More System Software and Operating System questions