With 3 initially empty frames, how many page faults does FIFO page replacement cause for the reference string 2, 4, 1, 4, 3, 2, 5, 4, 1, 2?
Correct answer B. 9
Explanation
FIFO evicts the page that has been in memory longest. Only the second reference to 4 is a hit; every other reference faults: 2, 4, 1, then 3 replaces 2, 2 replaces 4, 5 replaces 1, 4 replaces 3, 1 replaces 2 and 2 replaces 5, giving 9 faults. The optimal algorithm would cause only 6 on this string, showing how far FIFO can be from ideal.
Answer checked How we write and check questions
Discussion