CS FundamentalsVery hardGATE CS

Reference string: 0, 4, 1, 4, 2, 4, 3, 4, 2, 4, 0, 4, 1, 4, 2, 4, 3, 4. How many page faults does LRU give with 2, 3, 4 and 5 frames respectively (initially empty)?

  1. A. 10, 10, 8, 5
  2. B. 14, 11, 10, 5
  3. C. 10, 9, 8, 5
  4. D. 10, 9, 7, 5

Correct answer: C. 10, 9, 8, 5

Page 4 is referenced every other time, so it always stays; the other pages cycle 0, 1, 2, 3. With 5 frames everything fits (only 5 cold faults). With k frames, page 4 always occupies one (it is never least recent), so k − 1 frames serve the cycle of the other pages, and LRU on a cycle longer than its frames faults on nearly every such reference. Counts: 10, 9, 8, 5.

More Operating Systems questions

Exams that ask this topic