Question
An access sequence of cache block addresses is of length and contains unique block addresses. The number of unique block addresses between two consecutive accesses to the same block address is bounded above by . What is the miss ratio if the access sequence is passed through a cache of associativity exercising least-recently-used replacement policy?
Official answer and solution
- Official answer
- A
- From
- Official GATE 2014 answer key
Solution
Classify cache misses into compulsory and capacity/conflict misses under LRU replacement.
-
The access sequence has total length and contains unique block addresses.
-
Every block address must be brought into the cache on its very first access. These initial accesses are compulsory (cold) misses. Since there are distinct block addresses, there are exactly compulsory misses.
-
Now consider any re-access to an already-accessed block address :
- The problem states that the number of unique block addresses accessed between two consecutive accesses to is at most .
- Under the Least-Recently-Used (LRU) policy, a block is only evicted if at least other unique blocks are accessed after it, where is the associativity.
- Since , the number of intervening distinct blocks is strictly less than or equal to the cache associativity, so block can never be evicted before its subsequent access.
- Therefore, every subsequent access to any block is guaranteed to be a cache HIT.
-
Consequently, no capacity or conflict misses can occur. The total number of misses across all accesses is exactly .
-
The miss ratio is:
This matches option A.
A
Assuming the miss ratio depends on associativity or bound rather than the ratio of distinct blocks to total requests.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2014 Computer Science and Information Technology (CS) Session 1
- Question
- 54 of 65, printed as CS Q.44
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.