ITPEC FE Morning April 2020 Question 17
When the least recently used (LRU) method is used for swapping a block between cache memory and main memory, which of the following is a block in cache memory to be replaced?
Explanation
The block unreferenced for the longest time — LRU replaces the block whose last reference is the oldest.
LRU records when each block in the cache was last referenced and updates that time on every hit. When a new block must come in and there is no free place, it evicts the block with the oldest last reference, on the assumption that recently used blocks will be used again soon.
Answer (b)
Why not others:
- •(a) — the longest time since the block was added is FIFO, which ignores later references
- •(c) — the fewest references is LFU, which counts how often a block is used, not how recently
- •(d) — "not referenced for a certain period" is a fixed threshold that may match several blocks or none; LRU compares all candidates and picks the single oldest
Key rule: LRU goes by the time of the last reference, FIFO by the time of loading, and LFU by the number of references.
Computer Component · AI-written, may contain errors
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.