Explore key concepts of cache replacement policies, including LRU, FIFO, and randomized strategies, to sharpen your understanding of memory management algorithms and their performance implications. This quiz covers practical scenarios and essential characteristics relevant to computer architecture and caching systems.
Which cache replacement policy evicts the data that has not been used for the longest period of time?
Explanation: LRU stands for Least Recently Used and removes the entry that hasn't been accessed in the longest time. FIFO (First In, First Out) always removes the oldest entry regardless of usage. Randomized chooses any entry at random, and MRU (Most Recently Used) removes the item accessed most recently instead, which is different from LRU.
If a cache uses the policy of removing the item that was loaded earliest, regardless of whether it was used recently, which policy is this?
Explanation: FIFO, or First In, First Out, evicts the item that has been in the cache the longest without considering its usage. LRU looks at the least recently used data, LFU (Least Frequently Used) chooses the least used, and Randomized does not follow a fixed order.
Which cache replacement strategy often works best when data is accessed in loops with predictable patterns?
Explanation: LRU tends to perform efficiently with repeated and predictable access patterns, as it retains recently used data. FIFO ignores access frequency and order after insertion, Randomized is unpredictable and not tailored for access patterns, and LFU focuses on usage count, which is different from recency.
What is the main characteristic of a randomized cache replacement policy?
Explanation: A randomized policy picks any cache block for replacement regardless of recency or frequency, which provides simplicity but less predictability. Removing the least accessed item is LFU, FIFO removes in entry order, and MRU removes the most recently used, none of which occur randomly.
If you insert three items A, B, and C into a cache and then insert D, which replacement policy will remove A if no items were accessed again?
Explanation: With FIFO, the first inserted item (A) is removed since it was the earliest loaded, regardless of how often it was used. Randomized could remove any, LFU would need frequency information, and LRU removes the least recently used, but since none were accessed again, both FIFO and LRU could be correct, but FIFO is the most specific based on insertion order.
Why might a caching system use a randomized replacement policy instead of LRU or FIFO?
Explanation: Randomized replacement is simple and requires little overhead, making it attractive for hardware with limited resources. It does not guarantee higher hit rates, nor does it ensure data persistence. In fact, it requires less, not more, tracking information compared to policies like LRU.
What special information must a cache track to implement the LRU policy correctly?
Explanation: LRU requires tracking of the most recent access times for each cache item, making it possible to evict the least recently accessed. Insertion time is used in FIFO, frequency is for LFU, and random numbers are used for randomized replacement, not LRU.
During a sequential scan of data much larger than the cache, which policy is likely to perform similarly to FIFO in terms of cache misses?
Explanation: In long sequential scans, both FIFO and LRU tend to experience cache misses at similar rates because items are accessed only once before eviction. LFU depends on frequency, which is low for all, Randomized provides unpredictable results, and MRU behaves differently, sometimes causing even worse performance.
If a cache using LRU contains entries P, Q, R, S and P was the last accessed, which will be replaced next on a miss?
Explanation: In LRU, the item not accessed for the longest period is evicted, which is Q if all others have been accessed more recently. P is least likely as it was just accessed, while R and S are more recent than Q. This distinguishes LRU’s focus on recency from FIFO or other policies.
Which cache replacement policy typically requires the least amount of internal bookkeeping or tracking?
Explanation: Randomized replacement only needs to select a slot randomly and does not track timing or usage data, minimizing overhead. FIFO needs a queue for insertion order, LRU tracks access history, and LFU tracks access counts, all of which increase complexity compared to Randomized.