CS FundamentalsVery hardProduct company interview · GATE level

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

  1. A. FIFO 9 then 10; LRU 12 then 8
  2. B. FIFO 10 then 9; LRU 12 then 8
  3. C. FIFO 9 then 10; LRU 8 then 12
  4. D. FIFO 9 then 9; LRU 12 then 10

Correct answer: A. FIFO 9 then 10; LRU 12 then 8

FIFO with 3 frames faults 9 times, and with 4 frames 10 times - Belady's anomaly, caused by FIFO's eviction order: with more frames, the page evicted just before it is needed again can differ. LRU is a stack algorithm (the set of pages held with n frames is always a subset of the set held with n + 1), so adding a frame can never add faults; here it drops from 12 to 8. Any option with LRU rising is impossible for that reason.

More Operating Systems questions

Exams that ask this topic