You are on page 1of 3

Lab 4 Write-Up

I used the provided queue and node files to implement a FIFO queue, where if the cache size
was full, I would evict the item at the front of the queue and enqueue the new item at the back of
the queue.

Figure 1​ shows that cache hit performance got dramatically better with increase in cache size
and then abruptly levels off at a cache size of 1000.

Figure 1.​ Plotting # of cache misses as cache size is increased

I was remembering in our OSTEP text that cache hit performance actually decreased in certain
situations with the FIFO algorithm, so I decided to also test the lab4 program with the same
sequence that was described in Belady’s Anomaly, in the OSTEP text. As ​Figure 2​ shows,
there is a decrease in cache performance when going from a size of 300 to 400, this is
consistent with the OSTEP Chapter 22, page 5 text, that mentions:

The interesting part: how the cache hit rate changed when moving from a cache size of 3
to 4 pages. In general, you would expect the cache hit rate to increase (get better) when
the cache gets larger. But in this case, with FIFO, it gets worse!
Figure 2.​ Plotting # of cache misses as cache size is increased, with sequence of cache
accesses the same as the pattern where Belady’s anomaly is visible.
Test Output

Figure 3.​ Test output for a variety of cache sizes

You might also like