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

Consider three CPU intensive processes, which require 10,20 and 30 units of time and arrive at times 0,2 and 6 respectively. How many context switches are needed if the operating system implements a shortest remaining time first scheduling algorithm? Do not count the context switches at time zero and at the end.

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

Show answer & explanation

Correct answer: B. 2

Explanation

P1 runs 0–10 (P2 arriving at 2 needs 20 > 8 left), then P2 10–30, then P3 30–60. Two context switches (at 10 and 30).

More System Software and Operating System questions