Questions: Cache Associativity and Address Mapping Strategies

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A direct-mapped cache has 16 lines. Two frequently used arrays, A and B, happen to map to the same cache line. What happens when the program alternates between accessing elements of A and B?

AThe cache handles this efficiently by storing both arrays in the same line using compression
BEvery access causes a conflict miss: A evicts B, then B evicts A, even though the other 15 lines are empty
CThe CPU detects the conflict and automatically promotes the cache to 2-way associativity
DThe cache falls back to fully associative mode for those two addresses only
Question 2 Multiple Choice

Why is fully associative mapping impractical for large L1 caches despite eliminating conflict misses entirely?

AFully associative caches require more bits per address tag than direct-mapped caches
BOn every access, the hardware must compare the requested address tag against every stored tag simultaneously, requiring a comparator per cache line — infeasible at thousands of lines
CFully associative caches cannot use LRU replacement, limiting their hit rates
DFully associative caches require the CPU to pause for one clock cycle per cache line checked, making lookups too slow
Question 3 True / False

In a direct-mapped cache, a conflict miss can occur even when most of the cache lines are empty.

TTrue
FFalse
Question 4 True / False

Doubling cache associativity generally doubles cache performance — a 4-way set-associative cache is typically twice as fast as a 2-way cache.

TTrue
FFalse
Question 5 Short Answer

Explain why set-associative caches are described as a 'middle ground' between direct-mapped and fully associative designs. What does each design trade off?

Think about your answer, then reveal below.