5.4.10 · D5Memory Hierarchy & Caches
Question bank — Average memory access time (AMAT)
True or false — justify
Hit time is multiplied by the hit rate in the standard AMAT formula.
False. Start from the expected value ; the appears in both branches, so it factors out as . Hit time is unconditional; only carries the factor .
A lower miss rate always lowers AMAT, all else equal.
True. Treat AMAT as a function of ; its slope is a positive constant, so AMAT is strictly increasing in and any decrease in strictly decreases AMAT.
If the miss rate is 0, AMAT equals the hit time.
True. Substituting gives ; with no misses the penalty term is identically zero, so every access costs exactly one cache access.
If the miss rate is 100%, AMAT equals the miss penalty.
False. Substituting gives , not — because our convention makes the extra cost, a guaranteed miss still pays the hit access first. See Miss Penalty & Main Memory Latency.
Adding an L2 cache can never make AMAT worse.
False. Compare no-L2 AMAT with two-level . L2 helps only if , i.e. if ; violate this and AMAT rises.
The recursive multi-level AMAT uses global miss rates for the inner levels.
False. The outer factor already scales down to the accesses that reached L2, so the inner must be local; using the global rate inside would apply the discount twice. See Multi-level Cache Hierarchy.
Making the cache faster (lower ) is the best lever for reducing AMAT.
Usually false. Concretely with , , : AMAT ; halving to gives (−0.5), but halving to gives (−2.5). The term ( of the ns) dominates, so attacking or wins by far.
For a level with a very high hit rate, its hit time is essentially the whole AMAT.
True. As the term , so AMAT ; e.g. , gives , dominated by when is a few ns. This is why fast matters for L1, kept near-total-hit by Locality of Reference.
Global miss rate of L2 can be larger than its local miss rate.
False. Global with ; multiplying a non-negative number by a factor cannot increase it, so global local (equal only in the degenerate case ).
Spot the error
" — weighted average of the two outcomes."
The miss branch is wrong: a miss costs , not alone, since you still searched the cache first. The correct expected value collapses to .
"L2 miss penalty is 200 ns, so the L1 miss penalty in the recursive formula is also 200 ns."
The L1 miss penalty is the whole L2 subsystem's AMAT (), not the raw DRAM latency — most L1 misses are caught by L2 and never reach DRAM.
"I'll use the global L2 miss rate inside ."
The inner must be local; plugging in the global rate applies the L1 filtering already carried by the outer factor a second time.
"Miss penalty already includes the hit time, so total access on a miss is just ."
In our convention is the extra time beyond the hit access, so miss time is ; treating as inclusive contradicts the formula and undercounts by exactly .
"Since L1 misses are only 10%, the DRAM latency barely matters for AMAT."
It matters through the product , but with e.g. and ns the DRAM trips still add ns — often more than itself, so you must compute, not eyeball.
"Adding a bigger cache lowered miss rate, so AMAT must drop."
Not necessarily — a bigger cache often has a slower (see Cache Associativity & Hit Time tradeoff); if rises by more than falls, AMAT rises despite the better hit rate.
Why questions
Why is hit time added unconditionally instead of only on hits?
Because every request first probes the cache before we know hit-or-miss, is paid in both branches; in the expected value that shared term factors to a constant , independent of .
Why does layering caches multiply miss rates rather than add penalties?
Reaching DRAM requires missing at L1 and then missing at L2; using local rates, the fraction of all accesses that reach DRAM is (fraction missing L1) (fraction of those missing L2) — this is a definitional counting fact about nested conditional fractions, not a statistical independence assumption.
Why does AMAT "obsess" over the rare misses instead of the common hits?
In , if is 100–200× larger than , then even a small makes exceed ; e.g. gives a ns miss contribution versus ns hit — the rare-but-huge term dominates the mean.
Why do we use expected value (a probability average) to define AMAT at all?
Over accesses, total time ; dividing by to get the per-access average yields exactly — AMAT is literally the long-run mean time per access, which is the definition of expected value.
Why is local miss rate the right quantity inside the recursive formula?
The outer already restricts to the accesses forwarded to L2, so the inner probability must be conditioned on "given we reached L2, do we miss?" — that conditional fraction is precisely the local miss rate; using global would double-condition.
Why doesn't a high hit rate at L1 make L2 pointless?
Even a L1 miss rate times a ns DRAM trip adds ns per access; routing those misses through a fast L2 (say , ) replaces the with , cutting the contribution from to ns.
Why does the CPU performance equation care about AMAT?
AMAT sets the average memory-stall time per access; multiplying by accesses-per-instruction gives stall cycles per instruction, which the CPU Performance Equation adds to the base CPI — so AMAT directly inflates total execution time.
Edge cases
If a program has perfect locality and 0% miss rate at every level, what is AMAT?
Just — with the entire penalty bracket is multiplied by zero, so you only ever pay the fastest access time. This is the theoretical floor.
If miss rate is 100% at L1 but 0% at L2, what does AMAT reduce to?
— every access misses L1 and hits L2, so you always pay both levels' hit times and never touch DRAM.
What is AMAT when the miss penalty is zero (next level as fast as this one)?
AMAT , because misses cost nothing extra — a degenerate case where the hierarchy gives no penalty and the miss rate becomes irrelevant.
A workload that touches each address exactly once (no reuse) — what dominates AMAT?
Miss rate is driven near by compulsory (cold) misses, so AMAT — caches barely help without reuse. See Cache Miss Rate & Miss Types (3 Cs).
If grows so large it exceeds the old DRAM penalty, is L2 still worth adding?
No — L2 helps only when ; if that inequality fails outright, so every L1 miss got slower and AMAT increases, defeating the hierarchy's purpose.
As miss rate approaches zero, which term of AMAT vanishes and which survives?
In , the term while stays fixed — confirming hit time is the floor and misses only ever add on top of it.
Connections
- Cache Miss Rate & Miss Types (3 Cs)
- Miss Penalty & Main Memory Latency
- Multi-level Cache Hierarchy
- Cache Associativity & Hit Time tradeoff
- CPU Performance Equation
- Locality of Reference