Consider a -way set associative cache (initially empty) with total cache blocks. The main memory consists of blocks and the request for memory blocks are in the following order:
Which one of the following memory block will NOT be in cache if LRU replacement policy is used?
View worked solution
Answer: D
The cache is -way set associative with blocks. Therefore, the number of sets is:
Each memory block maps to a set using the formula: .
Let us trace the LRU queue for Set 0 (where blocks map) since the options and map here:
- Request 0: Set 0
- Request 4: Set 0
- Request 8: Set 0
- Request 216: Set 0 (Set is now full)
- Request 8 (Hit): Set 0 (8 becomes MRU)
- Request 48 (Miss): Replace LRU block
- Request 32 (Miss): Replace LRU block
- Request 92 (Miss): Replace LRU block
At the end of the sequence, block is evicted from the cache. Tracing Set 1 and Set 3 shows that blocks and remain in the cache.
Free practice · Your answers on this page are not saved.
