Belady's Anomaly Tested in Python: FIFO, LRU and Optimal Page Replacement
A GATE CS page replacement tutorial walks through counting faults under FIFO, LRU and Optimal policies using a small Python checker. The author notes a textbook reference string with 3 frames that is worked through without the answer printed. A random simulation of one million strings found FIFO faulting more with 4 frames than with 3 in a single case, while LRU never did. An exhaustive C count over all 5^12 strings found FIFO's anomaly in exactly 120 of them, roughly 1 in 2 million. The author advises checking a question's wording first, since only FIFO can exhibit this behavior, and cross-checking practice answers against official keys.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in