****************************** Problem 1: opt, LRU, FIFO ****************************** Assume these pages are referenced in this order: 0 1 2 0 1 3 0 3 1 2 1 How many misses occur with a cache of size=3 pages when using the... (a) optimal replacement policy? trace (over time): 0 1 2 0 1 3 0 3 1 2 1 hit (h) or miss (m) (over time): m m m h h m h h h m h what's in the cache (over time): 0 0 0 0 0 0 0 0 0 2 2 1 1 1 1 1 1 1 1 1 1 2 2 2 3 3 3 3 3 3 5 total misses. (b) LRU replacement policy? trace (over time): 0 1 2 0 1 3 0 3 1 2 1 hit (h) or miss (m) (over time): m m m h h m h h h m h what's in the cache (over time) (MRU at top, LRU at bottom): 0 1 2 0 1 3 0 3 1 2 1 0 1 2 0 1 3 0 3 1 2 0 1 2 0 1 1 0 3 3 5 total misses. (c) FIFO replacement policy? trace (over time): 0 1 2 0 1 3 0 3 1 2 1 hit (h) or miss (m) (over time): m m m h h m m h m m h what's in the cache (over time) (Last-In at top, First-In at bottom): 0 1 2 2 2 3 0 0 1 2 2 0 1 1 1 2 3 3 0 1 1 0 0 0 1 2 2 3 0 0 7 total misses. Please break those down into both (i) cold-start misses and (ii) capacity misses. Cold-start misses are defined as those misses which would occur even if you had an infinite-sized cache. Capacity misses are those misses that remain and are thus caused by the lack of room in the cache for the given page. Thus, for example, in the LRU trace above, the first misses to 0, 1, 2, and 3 are cold-start misses. Only the last miss in that trace is a capacity miss. Similar answer for optimal. For FIFO, there are the same cold-start misses but 4 capacity misses. ****************************** Problem 2: FIFO(3) vs. FIFO(4) ****************************** How many misses occur during this page-access sequence: 1 2 3 4 1 2 5 1 2 3 4 5 when using the FIFO replacement policy and ... (a) a cache of size=3 pages? Trace through this: the answer is 9. (b) a cache of size=4 pages? Trace through this: the answer is 10. Is there anything odd about this result? The oddness of the result is that a bigger cache can have more misses! This result is known as Belady's anomaly as Belady noticed it some years ago. It can occur for an algorithm like FIFO, but not LRU. Why do you think that is?