Skip to content
We areTOP 1%

What is Belady's anomaly?

MediumConceptPage Replacement & Thrashing
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews

Answer

Belady's anomaly is the surprising case in which giving a process more page frames causes more page faults. It can happen with FIFO page replacement, but never with LRU or Optimal.

  • FIFO evicts pages by when they were loaded, not by how they are used, so the set of pages it keeps with 4 frames is not always a superset of the set it keeps with 3 frames.
  • LRU and Optimal are stack algorithms: the pages kept with n frames are always a subset of those kept with n + 1 frames, so extra frames can never add faults.
  • The practical lesson: more memory does not guarantee fewer faults for every algorithm, which is one reason FIFO is rarely used on its own.

Example: reference string 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 under FIFO.

FramesFaultsReferences that hit
391 and 2 (8th and 9th), 5 (12th)
4101 and 2 (5th and 6th)

With 3 frames, the 5 at position 7 evicts 4 and keeps 1 and 2, which are needed next. With 4 frames, the same 5 evicts 1, the next 1 evicts 2, and every remaining reference faults in a chain.

More in Page Replacement & Thrashing

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account