GATE Computer Science · Operating Systems and Computer Networks · medium

For the page reference string 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 with 3 initially empty page frames, how many page faults occur under the LRU (Least Recently Used) page replacement policy?

Published · Last updated · checked before publication — how we verify questions

Options

  • A9 page faults matching the FIFO fault count on 3 page frames
  • B7 page faults matching the Belady Optimal (OPT) replacement bound
  • C10 page faults with hits on references 1 and 2 right after page 5Correct answer
  • D12 page faults with each reference missing in the 3-frame memory

Answer: C. 10 page faults with hits on references 1 and 2 right after page 5

Trace with 3 frames under LRU: 1(F:[1]), 2(F:[1,2]), 3(F:[1,2,3]), 4(F:evict 1->[4,2,3]), 1(F:evict 2->[4,1,3]), 2(F:evict 3->[4,1,2]), 5(F:evict 4->[5,1,2]), 1(Hit:[5,1,2]), 2(Hit:[5,1,2]), 3(F:evict 5->[3,1,2]), 4(F:evict 1->[3,4,2]), 5(F:evict 2->[3,4,5]). Total = 10 page faults (only the second 1 and second 2 after 5 are hits).

Why the other options are wrong

  • A. 9 page faults matching the FIFO fault count on 3 page frames — FIFO incurs 9 faults on 3 frames (and 10 on 4 frames), whereas LRU incurs 10 faults on 3 frames.
  • B. 7 page faults matching the Belady Optimal (OPT) replacement bound — 7 faults is the theoretical minimum under clairvoyant Optimal replacement, not LRU.
  • D. 12 page faults with each reference missing in the 3-frame memory — References 8 and 9 (1 and 2) are already in frames [5, 1, 2] and result in cache hits.

All Operating Systems and Computer Networks questions and the topic overview →

GATE is a mark of the Indian Institute of Science and the Indian Institutes of Technology. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by the GATE Committee.