In this exercise, we will examine how replacement policies impact miss rate. Assume a 2-way set associative
Question:
Consider the following address sequence: 0, 2, 4, 8, 10, 12, 14, 16, 0
1. Assuming an LRU replacement policy, how many hits does this address sequence exhibit?
2. Assuming an MRU (most recently used) replacement policy, how many hits does this address sequence exhibit?
3. Simulate a random replacement policy by flipping a coin. For example, heads means to evict the first block in a set and tails means to evict the second block in a set. How many hits does this address sequence exhibit?
4. Which address should be evicted at each replacement to maximize the number of hits? How many hits does this address sequence exhibit if you follow this optimal policy?
5. Describe why it is difficult to implement a cache replacement policy that is optimal for all address sequences.
6. Assume you could make a decision upon each memory reference whether or not you want the requested address to be cached. What impact could this have on miss rate?
Step by Step Answer:
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy