CS FundamentalsVery hardGATE CS

Three CPU-bound processes arrive at time 0 in the order A (burst 5), B (burst 3), C (burst 8). Round Robin with quantum 2 is used. Not counting the initial dispatch, how many context switches occur (a switch happens whenever a different process is dispatched; consecutive slices of the SAME process need no switch)?

  1. A. 8
  2. B. 16
  3. C. 3
  4. D. 7

Correct answer: D. 7

Slices: A | B | C | A | B | C | A | C | C. A switch occurs at each boundary between different processes: 7; the last two C slices run back to back. Counting every slice boundary gives 8, 16 is the total CPU time, and 3 assumes one switch per process.

More Operating Systems questions

Exams that ask this topic