FIFO

What it does

  • Removes the page that has been in memory the longest time.
  • Think of pages in memory as a queue: new pages go to the end, old ones removed from the front.

How it works

  • Maintain a queue of pages in memory.

  • On page fault:

    • If there’s free space → insert the page.
    • Else → remove the oldest page (front of the queue), insert new one at end.

Pros

  • Simple to implement (just use a queue).

Cons

  • May remove heavily used pages.
  • Suffers from Belady’s Anomaly: more frames can sometimes cause more faults!

Example

Reference string: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2

Frames: 3

StepPageFramesPage Fault?
177 _ _
207 0 _
317 0 1
420 1 2✅ (7 out)
500 1 2
631 2 3✅ (0 out)
702 3 0✅ (1 out)
843 0 4✅ (2 out)
920 4 2✅ (3 out)
1034 2 3✅ (0 out)
1102 3 0✅ (4 out)
1232 3 0
1322 3 0
  • Total Page Faults: 12
Last updated on