Consider a fully associative cache with 8 cache blocks (numbered 0-7) and the following sequence of memory block requests:
4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7
If LRU replacement policy is used, which cache block will have memory block 7?
(A) 4
(B) 5
(C) 6
(D) 7
Answer: (B)
Explanation: Block size is =8
Given 4, 3, 25, 8, 19, 6, 25, 8, 16, 35, 45, 22, 8, 3, 16, 25, 7
So from 0 to 7 ,we have
- 4 3 25 8 19 6 16 35 //25,8 LRU so next 16,35 come in the block.
- 45 3 25 8 19 6 16 35
- 45 22 25 8 19 6 16 35
- 45 22 25 8 19 6 16 35
- 45 22 25 8 3 6 16 35 //16 and 25 already there
- 45 22 25 8 3 7 16 35 //7 in 5th block
Therefore , answer is B