← The collection

Belady’s Anomaly.

Replay the same page requests through three-slot and four-slot caches under FIFO and LRU.

Interactive experimentintuitiveField note ·
INTERACTIVE EXPERIMENT / M33

Belady’s Anomaly

Replay the same page requests through three-slot and four-slot caches under FIFO and LRU.

TEST THE MECHANISM

The same request stream feeds caches of three and four slots. FIFO evicts the oldest arrival; LRU evicts the least recently used page. Hits only refresh order under LRU.

123412512345

Requests processed
0
3-slot faults
0
4-slot faults
0
Identical requests, different capacities
Request3 slots / result4 slots / result

For this complete stream, FIFO faults increase from 9 to 10 when capacity rises. LRU has the stack property; this anomaly does not apply to it.

The anomaly is policy- and workload-dependent; LRU’s stack property rules it out for that policy.

THE SHORT VERSION

Belady’s Anomaly, explained.

Belady’s anomaly is an increase in page faults after increasing cache capacity under some replacement policies, including FIFO.

01 / THE MECHANISM

Why it happens

The request stream is 1,2,3,4,1,2,5,1,2,3,4,5. FIFO evicts the earliest arrival without refreshing hits; LRU refreshes recency. Complete FIFO traces have nine faults with three slots and ten with four.

Belady’s anomaly is an increase in page faults after increasing cache capacity under some replacement policies, including FIFO.

Read the result

Compare fault counts after the same number of requests. A larger FIFO cache has a different eviction history, not simply the smaller cache plus one page.

02 / FOLLOW IT THROUGH

A worked example

A twelve-request cache counterexample

  1. Replay the full declared stream through the three-slot and four-slot FIFO caches.

  2. Inspect the complete fault totals of nine and ten, tracing the queue contents where their histories diverge.

  3. Switch to LRU and replay the identical requests to see why the policy’s inclusion property changes the conclusion.

OPTIONAL DEEPER DETAILGo deeper: inside the model

Inside this model

The request stream is 1,2,3,4,1,2,5,1,2,3,4,5. FIFO evicts the earliest arrival without refreshing hits; LRU refreshes recency. Complete FIFO traces have nine faults with three slots and ten with four.

03 / BEYOND THE EXPERIMENT

Where this idea is useful

A practical use

Measure the replacement policy as well as capacity before assuming more memory always reduces misses on a workload.

CHECK YOUR INTUITION

A common misconception

THE TEMPTING CONCLUSION

“Increasing cache capacity can never increase misses under any policy.”

THE MORE USEFUL DISTINCTION

FIFO is not a stack policy and can exhibit the anomaly. LRU retains the inclusion property that prevents it under the same request stream.

What this explanation leaves out

  • The anomaly is policy- and workload-dependent; LRU’s stack property rules it out for that policy.
ONE MORE QUESTION

Does the example mean a smaller cache is generally better?

No. It is a counterexample to a universal claim, not a workload distribution or a recommendation for smaller memory.

TAKE THE IDEA WITH YOU

Does your performance assumption depend on a policy property you have actually checked?

Associated thinkers

Associated withLászló Bélády ↗

Associations marked provisional are awaiting source review.

Further reading

Explore the original research or the teaching reference behind this experiment.