Search⌘ K

A Simple Policy: FIFO

Explore the FIFO page replacement policy for managing virtual memory pages, understanding its simple queue-based eviction method. Learn about its performance impacts, including the notable Belady's Anomaly where increasing cache size can worsen hit rates. This lesson helps you grasp fundamental concepts and limitations of FIFO compared to other policies.

We'll cover the following...

Many early systems avoided the complexity of trying to approach optimal and employed very simple replacement policies. For example, some systems used FIFO (first-in, first-out) replacement, where pages were simply placed in a queue when they entered the system; when a replacement occurs, the page on the tail of the queue (the “first-in” page) is evicted. FIFO has one great strength: it is quite simple to implement.

Example

Let’s examine how FIFO does on our example reference stream (see figure below).

We again begin our trace with three compulsory misses to pages 0, 1, and 2, and then hit on both 0 and 1. Next, page 3 is referenced, causing a miss; the replacement decision is easy with FIFO: pick the page that was the “first one” in (the cache state in the figure is kept in FIFO order, with the first-in page on the left), which is page 0. Unfortunately, our next access is to page 0, causing another miss and replacement (of page 1). We then hit on page 3, but miss on 1 and 2, and finally hit on 3.

Comparing FIFO to optimal, FIFO does notably worse: a 36.4% hit rate (or 57.1% excluding compulsory misses). FIFO simply can’t determine the importance of blocks: even though page 0 had been accessed a number of times, FIFO still kicks it out, simply because it was the first ...