Consider a -way set associative cache with blocks and uses replacement. Initially the cache is empty. Conflict misses are those misses which occur due to the contention of multiple blocks for the same cache set. Compulsory misses occur due to first time access to the block. The following sequence of access to memory blocks :
is repeated times. The number of conflict misses experienced by the cache is _________ .
View worked solution
Answer: 76
The cache is -way set associative with blocks. Thus, the number of sets is:
The set index for any memory block is given by . Mapping the blocks in the sequence to their respective sets:
- Set 0: Blocks
- Set 1: Blocks
Since the sets are independent, we can analyze the accesses to Set 0 and Set 1 separately. Because the access patterns are identical in structure, both sets will experience the same number of conflict misses.
Analysis for Set 0 (Capacity = 2 blocks, LRU):
The access sequence for Set 0 in one iteration is: .
Iteration 1:
- Access : Compulsory Miss (Cache: )
- Access : Compulsory Miss (Cache: )
- Access : Compulsory Miss (Cache: , evicted)
- Access : Hit (Cache: )
- Access : Conflict Miss (Cache: , evicted)
- Access : Hit (Cache: )
- Access : Conflict Miss (Cache: , evicted)
- Access : Hit (Cache: )
In Iteration 1, Set 0 has 2 conflict misses. The state of Set 0 at the end of Iteration 1 is (with as MRU and as LRU).
Iterations 2 to 10 (9 iterations):
Starting with state :
- Access : Conflict Miss (Cache: )
- Access : Hit (Cache: )
- Access : Conflict Miss (Cache: )
- Access : Hit (Cache: )
- Access : Conflict Miss (Cache: )
- Access : Hit (Cache: )
- Access : Conflict Miss (Cache: )
- Access : Hit (Cache: )
Each of the remaining 9 iterations results in exactly 4 conflict misses.
Total Conflict Misses:
- Conflict misses for Set 0 =
- Conflict misses for Set 1 = (by symmetry)
Total conflict misses experienced by the cache = .
Free practice · Your answers on this page are not saved.
