CS FundamentalsVery hardGATE CS (PYQ pattern)

With 3 frames (initially empty) the reference string is 2, 5, 3, 6, 2, 5, 4, 2, 4, 2, 1, 2, 5, 6, 6, 1, 2, 3, 6, 3, 4, 4. The clock (second-chance) algorithm sets a page's reference bit on load and on every hit, and on a fault sweeps from the hand clearing set bits until it finds a clear one, replacing it and advancing the hand one step. By how many faults does plain FIFO exceed clock?

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

Correct answer: B. 3

FIFO gives 16 faults and clock gives 13: the reference bit lets clock keep re-used pages that FIFO would evict in arrival order, so the difference is 3.

More Operating Systems questions

Exams that ask this topic