A 2-way set-associative cache set holds blocks A and B. The access sequence is A, B, A, C. Under LRU replacement, which block does C replace?

Correct answer B. B

Explanation

After A, B, A the most recently used block is A and the least recently used is B, so C evicts B. FIFO would instead evict A, since A was loaded first, even though it was just reused. LRU exploits temporal locality: a block used recently is likely to be used again soon. Real caches often approximate LRU with cheaper pseudo-LRU bits.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.