CS FundamentalsHardProduct-company MCQ pattern

Processes: P1 (arrival 0, burst 7), P2 (arrival 2, burst 4), P3 (arrival 4, burst 1), P4 (arrival 5, burst 4) (ms), scheduled by SRTF. Not counting the initial dispatch at t = 0 or the switch away from the last process when it finishes, how many context switches occur?

  1. A. 6
  2. B. 3
  3. C. 4
  4. D. 5

Correct answer: D. 5

Gantt: P1 0–2 | P2 2–4 | P3 4–5 | P2 5–7 | P4 7–11 | P1 11–16. Switches at 2, 4, 5, 7 and 11 = 5. P4 arriving at 5 does not preempt P2 (remaining 2 < 4), a common miscount.

More Operating Systems questions

Exams that ask this topic