5.4.9 · D5Memory Hierarchy & Caches
Question bank — Cache miss types (compulsory, capacity, conflict)
Reminder of the three yardsticks before you start:
- Infinite cache → leaves only compulsory misses.
- Fully-associative, finite → leaves compulsory + capacity.
- Real (limited-associativity) → leaves all three.
True or false — justify
Every miss on data you touched before is a conflict miss.
False — it could be a capacity miss. It is only conflict if a fully-associative cache of the same size would have hit; otherwise the cache was simply too small.
A fully-associative cache can still suffer capacity misses.
True — full associativity removes only the mapping restriction (conflict). If the working set exceeds the number of lines, blocks still get evicted for lack of room. See Working Set & Program Behavior.
A fully-associative cache can suffer conflict misses.
False, by definition — conflict misses come from a mapping rule forcing two blocks into the same slot, and full associativity imposes no such rule.
Compulsory misses can be eliminated by adding associativity.
False — a compulsory miss is the first ever touch of a block; nothing was there to keep, so slot arrangement is irrelevant. Only Prefetching or larger blocks (via spatial locality) reduces them.
Doubling the cache size can increase conflict misses.
True in pathological cases, but the standard result: doubling size can shift the index mapping so some strides that used to collide now don't (usually fewer conflicts). The reliable fix for conflict remains associativity, not size.
A direct-mapped cache has more conflict misses than a fully-associative one of the same size.
True — direct-mapped gives each block exactly one home, so any two blocks with the same index fight; more associativity gives more homes per set and softens this.
Increasing associativity never hurts performance.
False — it removes conflict misses but adds hit latency, energy, and can lower the clock speed. The 3 C's count says nothing about time per hit; see Average Memory Access Time (AMAT).
The number of compulsory misses equals the number of distinct blocks the program touches.
True — each unique block must be fetched from memory at least once, and that first fetch is unavoidable in any cache, even an infinite one.
Bigger cache blocks always reduce total misses.
False — bigger blocks cut compulsory misses (more neighbours per fetch) but leave fewer distinct blocks resident, raising capacity and conflict misses. It's a trade-off with an optimum, per Cache Block Size Trade-offs.
Spot the error
"This access misses, and it's not the first touch, so it must be a conflict miss."
The error skips the capacity test. You must simulate a same-size fully-associative cache: if that also misses, it's capacity, not conflict.
"Our cache is fully-associative, so if a repeated block misses it must be a conflict miss."
Impossible — fully-associative caches have zero conflict misses. A repeated-block miss there is a capacity miss caused by an oversized working set.
"We removed all conflict misses by going 2-way associative, so total misses dropped to zero."
Removing conflicts does not touch compulsory or capacity misses. Cold blocks still miss on first touch, and an oversized working set still overflows the cache.
"Compulsory = Misses in a fully-associative finite cache."
Wrong yardstick. Compulsory = misses in an infinite cache. The fully-associative finite cache leaves compulsory plus capacity misses.
"Conflict count = real misses minus infinite-cache misses."
That difference is capacity + conflict together. Conflict alone = ; capacity = .
"Since LRU is optimal, a fully-associative LRU cache gives the true minimum miss count."
LRU is a good heuristic but not optimal; Belady's optimal policy can do better. Still, LRU is the standard reference used to define capacity misses, so the classification is defined relative to it.
Why questions
Why do we define miss types by comparing against idealized caches instead of by intuition?
Because each ideal cache removes exactly one cause of miss, so subtracting their miss counts isolates each cause cleanly. Intuition fails on subtle cases (a repeated block can still be capacity, not conflict).
Why does the index formula mechanically produce conflict misses?
Two blocks whose block-numbers are congruent mod the number of sets map to the same set, so they evict each other even when the rest of the cache sits empty.
Why can't prefetching fix capacity misses?
Prefetching only hides the latency of a fetch by starting it early; it doesn't create more room. If the working set exceeds the cache, prefetched blocks still get evicted before reuse. See Prefetching.
Why does associativity fix conflict but not capacity?
Associativity adds more homes per set, so colliding blocks can coexist — that erases conflict. But it doesn't add total lines, so an oversized working set still overflows: capacity is untouched.
Why is the 3 C's decomposition useful to a designer at all?
It maps each miss cause to a distinct cure — size for capacity, associativity for conflict, prefetch/block-size for compulsory — so you spend transistors on the cause that actually dominates your program.
Edge cases
An infinite cache runs a program. Which miss types can occur?
Only compulsory — nothing is ever evicted, so no capacity or conflict misses are possible; every miss is a first touch.
A program touches only 2 distinct blocks that map to the same set in a direct-mapped cache and alternates between them forever. What miss types occur?
2 compulsory (first touches) then endless conflict misses — the 2-block working set fits a fully-associative 2-line cache, so it's pure conflict, curable by 2-way associativity.
A program's working set exactly equals the cache size, run on a fully-associative LRU cache, and it cycles through all blocks in order. What happens?
Every re-reference misses (capacity) — LRU evicts the block that is about to be reused next, so a working set that just barely doesn't fit thrashes. A single extra line, or a different policy, can rescue it.
Can a single access be both a capacity and a conflict miss at once?
No — the classification is mutually exclusive by construction: test infinite (compulsory), then same-size fully-associative (capacity), else conflict. Each real miss lands in exactly one bin.
A cache is cold (just powered on) and the program's very first access misses. Which type, always?
Always compulsory — no data has ever been loaded, so it cannot be capacity or conflict regardless of associativity or size.
If two different programs have identical total miss counts, must their designs need the same fix?
No — one might be conflict-dominated (needs associativity) and the other capacity-dominated (needs a bigger cache). Equal totals hide completely different cures, which is exactly why the 3 C's breakdown matters.