The three C's come from Mark Hill's PhD thesis at Berkeley, "Aspects of Cache Memory and Instruction Buffer Performance" (1987). When Hill received the 2019 Eckert–Mauchly Award, the ACM's announcement credited the model with having "led to important innovations such as victim caches and stream buffers" — both in lesson 25.
Misses, penalties and the design space: the second level, the 3 C’s, from misses to seconds
After this lesson you will compute the average access time of a two-level cache and tell a local miss rate from a global one, turn misses into CPU time with the memory-stall formula of the June 2025 exercise, sort any miss into compulsory, capacity or conflict, and say which term of AMAT each design choice moves.
The notes' Example 7 (p. 261) follows 1000 memory references through two caches. 40 of them miss in the first-level cache, L1, and are passed down to the second-level cache, L2; 20 of those 40 miss there too. The L2 fails on half of what it is asked. Hennessy & Patterson run the same counts with latencies — 1 cycle for L1, 10 for L2, 200 for main memory — and get an average of 5.4 cycles per access. Without the L2 the same latencies give 9. How can a cache that fails one time in two save 40%?
The 10 June 2025 paper has a CPU3 whose instructions all take 8 clock cycles, and a real cache that stretches its CPU time by 56% over an ideal cache that never misses. Put a core eight times better, 1 cycle per instruction, behind the same memory, and the same misses stretch its time 5.5 times. Why does the better core suffer more?
Both have one-line answers, and you will write them by the end of the lesson.
A second chance before memory: the L2 cache
The first-level cache has to answer at the speed of the pipeline, in a cycle or two, so it must be small — and, in the notes' words (p. 260), "small cache, relatively high miss rate". With one level of cache every L1 miss is a trip to DRAM.
The fix is a second-level cache, L2, between L1 and main memory, and its "main job is to catch L1 cache misses before they reach main memory" (p. 315). It is larger than L1 (hundreds of KB to several MB), slower than L1 but much faster than DRAM, usually unified (instructions and data together), built in SRAM like L1 and, in modern processors, on the same chip. An access now has three places to end:
- L1 hit: the data comes back at once.
- L1 miss, L2 hit: the block comes from L2 into L1 and to the CPU, after the L2 hit time.
- L1 miss, L2 miss: the block comes from main memory, the slow trip.
It works because the small L1 has to evict blocks that are still useful, and the larger L2 still holds many of them: "a large fraction of L1 misses are 'saved' by L2" (p. 315).
Two levels, one formula: nest the AMAT
Start from the one-level formula of lesson 22 and ask only one new question: what does an L1 miss cost now?
The one-level formula, written for L1:
\[ \text{AMAT} = HT_{L1} + MR_{L1} \times MP_{L1} \]An L1 miss is served by the L2. Seen from L1, the L2 is just a slower memory with a hit time, a miss rate and a penalty of its own, so what one L1 miss costs is the average access time of the L2:
\[ MP_{L1} = HT_{L2} + MR_{L2} \times MP_{L2} \]Substitute. This is the notes' eq. 77 and the "Hierarchical (L1, L2)" line of the example formula sheet on the course page:
\[ \begin{aligned} \text{AMAT} = {} & HT_{L1} + MR_{L1} \times {} \\ & (HT_{L2} + MR_{L2} \times MP_{L2}) \end{aligned} \]Multiply out: three terms, one per level an access may have to visit (eq. 52):
\[ \begin{aligned} \text{AMAT} = {} & HT_{L1} + MR_{L1}\, HT_{L2} \\ & + MR_{L1}\, MR_{L2}\, MP_{L2} \end{aligned} \]Read the terms. Every access pays the L1 hit time; the fraction \(MR_{L1}\) that misses in L1 also pays the L2 hit time; the fraction \(MR_{L1} MR_{L2}\) that misses in both also pays the trip to memory. A third level repeats the move:
\[ MP_{L2} = HT_{L3} + MR_{L3} \times MP_{L3} \]
- \(HT_{L1}\)
- L1 hit time: paid by every access
- \(MR_{L1}\)
- L1 miss rate: L1 misses / all CPU accesses
- \(HT_{L2}\)
- L2 hit time: paid by every L1 miss
- \(MR_{L2}\)
- local L2 miss rate: L2 misses / L1 misses, the accesses that reach L2
- \(MP_{L2}\)
- L2 miss penalty: the trip to main memory
The notes' Example 8 (p. 316) in numbers: \(HT_{L1} = 1\) cycle, \(MR_{L1} = 5\%\), \(HT_{L2} = 10\) cycles, \(MR_{L2} = 20\%\), \(MP_{L2} = 100\) cycles. An L1 miss now costs 10 + 0.2 × 100 = 30 cycles instead of 100, and the average access 1 + 0.05 × 30 = 2.5 cycles. Without the L2 the same misses go straight to memory: 1 + 0.05 × 100 = 6 cycles. (The notes assume, without saying so, that memory is 100 cycles away from L1 as well as from L2.)
Before: L1 only
After: L1 + L2
An L2 does not make L1 miss less often; it makes every L1 miss cheaper: \(HT_{L2} + MR_{L2} \times MP_{L2}\) instead of the trip to memory.
Local and global miss rates
Back to Example 7 (p. 261): 1000 references, 40 misses in L1, 20 misses in L2. A miss rate is misses divided by accesses — but which accesses? The notes give two answers.
Local miss rate of a level — its misses divided by the accesses to that level. L1: 40 / 1000 = 4%. L2: 20 / 40 = 50%, because only the 40 L1 misses ever reach it.
Global miss rate of a level — its misses divided by all CPU accesses. L1: 40 / 1000 = 4%, the same as its local rate, since every access reaches L1. L2: 20 / 1000 = 2%.
The global rate is "what really matters" (p. 261): it is the share of all accesses so unlucky that they pay the trip to memory — here 2%, half of the 4% that would pay it without an L2. The local rate of an L2 looks bad because L1 has already served the easy accesses, the ones with locality, so the L2 is asked only about the hard ones. A local miss rate of 50% at L2 is no failure, and it cannot be compared between machines: put a better L1 in front of the same L2 and the L2's local rate rises although nothing in the L2 changed. To compare hierarchies, compare global rates.
A paper may give the L2 as a hit rate, and that hit rate is local. Question 3 of the 8 January 2026 paper, as the notes reproduce it (p. 503): L1 hit rate 95%, L2 hit rate 90%, "How much is the Global Miss Rate for Last Level Cache?" The last-level cache is the lowest cache before memory, here L2: 0.05 × 0.10 = 0.005 = 0.5% of all accesses reach memory. The AMAT of the same machine is an exam question at the end of the lesson.
"The global L2 miss rate is 2%, so AMAT = 1 + 0.04 × (10 + 0.02 × 200)." That multiplies by \(MR_{L1}\) twice, because the global rate already contains it: the result, 1.56 cycles, is far below the true 5.4. The nested formula takes the local rate. Given a global rate, use the expanded form, \(HT_{L1} + MR_{L1} HT_{L2}\) + global rate × \(MP_{L2}\).
A local miss rate measures a level against what reaches it; only the global rate counts the accesses that pay the trip to memory.
From misses to seconds: memory stalls in the CPU time
AMAT is a cost per memory access. The exam asks for CPI and CPU time, costs per instruction, and lesson 3 gave the frame: CPU time = IC × CPI × \(T_{CLK}\). What is left is how the misses get into the CPI.
Count it first on the CPU3 of the June 2025 paper. With an ideal cache every instruction takes 8 cycles. Each instruction makes 3 memory accesses on average, half of them miss, and each miss stalls the processor for 3 more cycles. Two instructions make 6 accesses, 3 misses and 9 stall cycles: 16 + 9 = 25 cycles for 2 instructions, 12.5 per instruction.
The general form adds the two parts in the same way (p. 262). It is the Iron Law with the cycles split into work and waiting:
Split the cycles of the program into normal work and waiting for memory:
\[ \begin{aligned} \text{CPU time} = {} & (\text{exec cycles} \\ & + \text{stall cycles}) \\ & \times T_{CLK} \end{aligned} \]The work is the Iron Law with \(CPI_{exec}\), the CPI "without considering cache misses": every access a hit (eq. 55):
\[ \text{exec cycles} = IC \times CPI_{exec} \]The waiting is the number of misses times the price of one (eq. 56):
\[ \begin{aligned} \text{stall cycles} = {} & IC \times \frac{\text{misses}}{\text{instruction}} \\ & \times MP \end{aligned} \]Misses per instruction: chain two ratios so that the memory accesses cancel (eq. 57, corrected below):
\[ \begin{aligned} \frac{\text{misses}}{IC} &= \frac{\text{accesses}}{IC} \times \frac{\text{misses}}{\text{accesses}} \\ &= MAPI \times MR \end{aligned} \]Put the pieces together and take IC out of the bracket (eq. 58–59): the CPI grows by the stall cycles of each instruction.
\[ \begin{aligned} CPI &= CPI_{exec} \\ &+ MAPI \times MR \times MP \end{aligned} \] \[ \text{CPU time} = IC \times CPI \times T_{CLK} \]
- \(CPI_{exec}\)
- cycles per instruction when every access hits: the "ideal cache" of the paper
- \(MAPI\)
- memory accesses per instruction; when the cache also holds instructions, the fetch counts (1 + loads and stores per instruction). The exam gives the number
- \(MR\), \(MP\)
- miss rate, a fraction (50% enters as 0.5); miss penalty, in clock cycles
- \(MAPI \times MR\)
- misses per instruction; times \(MP\), the memory stall cycles per instruction
The three cases of the June 2025 exercise
The paper asks for CPU3 with an ideal cache, with the real cache and with no cache at all. "Ideal cache" is a miss rate of 0; "no cache" is treated, as on p. 263, as a cache that always misses (miss rate 1) with the same 3-cycle penalty.
| ideal cache | real cache | no cache | |
|---|---|---|---|
| miss rate | 0 | 0.5 | 1 |
| stalls: MAPI × MR × MP | 3 × 0 × 3 = 0 | 3 × 0.5 × 3 = 4.5 | 3 × 1 × 3 = 9 |
| CPI3 = 8 + stalls | 8 | 12.5 | 17 |
| impact | the reference | 12.5 / 8 = 1.5625 | 17 / 12.5 = 1.36 |
It is the same program on the same CPU in all three cases: IC and \(T_{CLK}\) are equal and cancel, so the ratio of the CPU times is the ratio of the CPIs. With the real cache CPU3 takes 56.25% more time than with an ideal one; without a cache, 36% more than with the real one (2.125 times the ideal). Part 1 of the same exercise compares CPU1 and CPU2, which have different clocks, and there the CPI ratio is not the answer (lesson 3). If the pipeline also stalls for hazards, the two kinds of stall simply add (eq. 60):
\[ \begin{aligned} CPI = {} & CPI_{exec} \\ & + \text{hazard stalls / instr.} \\ & + MAPI \times MR \times MP \end{aligned} \]Why a faster core suffers more
The 4.5 stall cycles per instruction belong to the memory system: at the same clock, the core does not appear in MAPI × MR × MP. What changes from core to core is what they are added to. On top of 8 cycles of work they add 56%. On top of 1 cycle, a core eight times better, they make the CPI 5.5, 5.5 times the ideal, and the better core finishes only 12.5 / 5.5 = 2.27 times sooner, not 8. A faster clock makes it worse: memory's latency in nanoseconds stays, so its penalty in cycles grows. The notes draw the moral on p. 263: "even if we build the fastest CPU core in the world, if our memory system is slow, our real performance will be bad!"
Two levels in the CPU time
With an L2 there are two kinds of stall (p. 264): every L1 miss waits for the L2 hit time, and an access that misses in both waits for the trip to memory on top. Count each kind per instruction with MAPI, and watch which rate it needs:
- stalls
- memory stall cycles per instruction; CPU time = IC × (\(CPI_{exec}\) + stalls) × \(T_{CLK}\)
- \(\text{misses}_{L1}\)
- misses in L1 per instruction: MAPI × \(MR_{L1}\)
- \(\text{misses}_{L2}\)
- misses in L2 per instruction: MAPI × \(MR_{L1} \times MR_{L2}\), with the global rate
| Quantity | With L2 | Without L2 |
|---|---|---|
| misses in L1 per instruction, MAPI × MRL1 | 1.5 × 0.04 = 0.06 | 0.06 |
| misses in L2 per instruction, MAPI × MRL1 × MRL2 | 1.5 × 0.02 = 0.03 | — (all 0.06 go to memory) |
| stall cycles per instruction | 0.06 × 10 + 0.03 × 200 = 6.6 | 0.06 × 200 = 12 |
| CPI = 1.0 + stalls | 7.6 | 13 |
| AMAT | 5.4 | 9 |
| check: MAPI × (AMAT − HTL1) | 1.5 × 4.4 = 6.6 | 1.5 × 8 = 12 |
The L2 makes this machine 13 / 7.6 = 1.71 times faster. Look at the last row: the stall formula is the expanded AMAT without its first term, multiplied by MAPI. The L1 hit time is missing on purpose: \(CPI_{exec}\) already counts every access as an L1 hit, so a stall is only what comes on top of it.
\[ \text{stalls} = MAPI \times (\text{AMAT} - HT_{L1}) \]"CPI = \(CPI_{exec}\) + MAPI × AMAT." That counts the L1 hit time twice: once inside \(CPI_{exec}\), once inside AMAT. With the numbers above it gives 1 + 1.5 × 5.4 = 9.1 instead of 7.6. Subtract the hit time first.
CPI = \(CPI_{exec}\) + MAPI × MR × MP: misses per instruction times the price of one miss, added to the work of the core.
Why a miss happens: the three C's
Take the notes' own collision (p. 306): blocks 12 and 20 in a direct-mapped cache of 8 blocks. 12 mod 8 = 4 and 20 mod 8 = 4, so both may live only in line 4 (the placement rule of lesson 23). Read them in turn and every access misses. Is the cache too small? It has 8 lines and the program uses 2. Is it the cold start? Only for the first two accesses. The other four misses happen because the two blocks were given the same place.
| Memory Address | Hit/Miss Type | Fully associative, 8 blocks | Cache Tag | Set | Cache Address |
|---|---|---|---|---|---|
| [12]10 | Cold-start Miss | Cold-start Miss | [01]2 | [4]10 | e |
| [20]10 | Cold-start Miss (evicts 12) | Cold-start Miss | [10]2 | [4]10 | e |
| [12]10 | Conflict Miss (evicts 20) | Hit | [01]2 | [4]10 | e |
| [20]10 | Conflict Miss (evicts 12) | Hit | [10]2 | [4]10 | e |
| [12]10 | Conflict Miss (evicts 20) | Hit | [01]2 | [4]10 | e |
| [20]10 | Conflict Miss (evicts 12) | Hit | [10]2 | [4]10 | e |
Miss rate 6 / 6 = 100% in the direct-mapped cache, 2 / 6 = 33% in the fully associative one. The notes sort misses by cause into three kinds, plus a fourth for multiprocessors (pp. 319–320):
- Compulsory (cold-start) misses: the first access to a block, which cannot be in the cache yet. "These always occur, even with infinite cache." Reduced by prefetching or larger blocks.
- Capacity misses: "The cache is too small to hold all the data the program is working on", so useful blocks are evicted and missed again. Reduced by a larger cache.
- Conflict (collision, interference) misses: blocks that "map to the same cache set, and they overwrite each other, even if the cache is not full". Reduced by higher associativity or a victim cache.
- Coherence misses, in multiprocessors only: another processor writes a block this core holds, the copy is invalidated, and the next access misses (lesson 35).
"Too small" and "the same place" need a test you can apply to a trace. Hennessy & Patterson (background, not in the notes) define each C by comparing your cache with two imaginary caches that have the same block size:
Compulsory misses — the misses an infinite cache would also have: the first reference to each block.
Capacity misses — the misses of a fully associative cache of the same size, minus the compulsory ones.
Conflict misses — the misses of your cache minus the misses of that fully associative cache.
Run the ping-pong through the tests. Infinite cache: 2 misses, the first touches, so 2 compulsory. Fully associative, 8 blocks: still 2 misses, so 0 capacity. Direct-mapped: 6 misses, so 6 − 2 = 4 conflict. In a 2-way cache of the same size both blocks go to set 0 (12 mod 4 = 20 mod 4 = 0) and fit in its two ways: 2 misses. So the C belongs to the access in a given cache, not to the block, and the totals add up: misses = compulsory + capacity + conflict (+ coherence).
The July 2024 table of lesson 23 has eight misses, all first touches, three of which evict a block: by the definitions all eight are Cold-start, since no bigger or more associative cache could have avoided any of them. No official solution settles how the paper labels a first touch that evicts, so write the reason next to the type, "Cold-start Miss (replaces LRU 14)", as lesson 23 does.
"A miss that evicts a block from a full set is a conflict miss." Eviction is not the test. A first reference is cold-start whatever it evicts; a re-reference is conflict only if a fully associative cache of the same size would have hit, and capacity if that cache would have missed too.
Compulsory: an infinite cache would miss too. Capacity: a fully associative cache of the same size would miss too. Conflict: only your organisation misses.
The design space: five knobs, three terms
"Changing one parameter usually impacts hit time, miss rate, and miss penalty, so it's always about trade-offs" (p. 317). The notes list five knobs: cache size, block size, associativity, replacement policy and write policy. The three C's tell you which misses each knob attacks, and AMAT tells you what it costs. Here is the notes' Table 27 (p. 318), read through the three terms:
| Knob, turned up | Buys | Costs |
|---|---|---|
| bigger cache | miss rate ↓: fewer capacity misses | hit time ↑: "more bits to check, longer wires"; area, power |
| larger block | miss rate ↓: fewer compulsory misses (spatial locality) | miss penalty ↑: more bytes per miss; miss rate ↑ again when fewer blocks fit and conflicts grow |
| more ways (associativity) | miss rate ↓: fewer conflict misses | hit time ↑: more tags to compare; hardware complexity |
| LRU instead of random or FIFO | miss rate ↓, usually: keeps the blocks in use (temporal locality) | usage-order bits per set, expensive at many ways |
| write-back instead of write-through | memory traffic ↓ (no AMAT term of its own) | complexity ↑: dirty bits; a dirty victim to write back on a miss |
A bigger cache misses less but answers more slowly. "We can't make L1 huge without slowing it down, that's why big caches are placed at L2 or L3" (p. 317): the second level exists because of this trade-off. Block size has a sweet spot, where fewer, larger blocks start to collide and every miss carries more bytes; lesson 25 measures it. For replacement, the notes' trend is LRU at 2–4 ways and pseudo-LRU or random above, where tracking the exact order of use costs too much. The write policy has no term of its own in AMAT: write-back saves memory traffic (lesson 23), and the dirty victim it may have to write back on a miss is handled in lesson 26.
Three strategies, and a quiz the notes got backwards
Sort the techniques by the term they attack and you get the notes' three strategies (pp. 321–322): reduce the miss rate, reduce the miss penalty, reduce the hit time. They are the map of the next four lessons, and they are exactly what Question 4 of the 8 January 2026 paper tests: "Which of the following cache improvements are effective in reducing the miss penalty?"
The L2 of this lesson is Answer 3. The other miss-penalty answer is 4: a read miss that would wait behind buffered writes, or behind the write-back of a dirty victim, is served first (lesson 26). Answer 2 shortens every hit: index bits that need no translation let the TLB and the cache look up in parallel (lesson 27). Answer 1 removes conflict misses: miss rate.
Back to the two puzzles
The L2 of Example 7 misses half of what it is asked, but it is asked only about the 40 accesses in 1000 that L1 could not serve. Against all accesses its misses are 2%, half of the 4% that went to memory without it: an L1 miss costs 110 cycles instead of 200, the average access 5.4 instead of 9. The 50% is a local rate; the global 2% is the one that matters.
The 4.5 stall cycles of CPU3 belong to the memory system. On top of 8 cycles of work they add 56%; on top of 1 cycle they multiply the time by 5.5. A faster core shrinks only its own part of the CPI, so memory's share grows — which is why the next four lessons attack the miss rate, the miss penalty and the hit time one by one.
Size, block and associativity each move two terms of AMAT: judge a knob by the sum, never by the miss rate alone.
Exam-style questions
The questions follow the paper's forms: two exercises answered with every intermediate number, a single-answer quiz with its motivation, a numeric follow-up, two multiple-answer quizzes and an eight-point open question. The model answers are recomputed here, not official solutions.
PERFORMANCE EVALUATION (part 2). Evaluate the impact of the memory hierarchy on another CPU3 for which all instructions require 8 clock cycles in the following cases:
1. How much is the CPI3 when considering an ideal cache (100% hit)? CPI3_ideal_cache = …
2. How much is the CPI3 when considering a real cache with a miss rate of 50% and assuming 3 memory accesses on average for each instruction and miss penalty of 3 clock cycles? CPI3_real_cache = … How much is the impact on performance of the real cache with respect to the ideal cache (100% hit)?
3. How much is the CPI3 in the case of no cache (100% miss)? CPI3_no_cache = … How much is the impact on performance with respect to the real cache (50% hit)?
Show model answer
CPI = CPI_exec + memory accesses per instruction × miss rate × miss penalty, with CPI_exec = 8 clock cycles.
1. CPI3_ideal_cache = 8 + 3 × 0 × 3 = 8.
2. Stall cycles per instruction = 3 × 0.5 × 3 = 4.5; CPI3_real_cache = 8 + 4.5 = 12.5. Same IC and same clock, so the ratio of the CPU times is the ratio of the CPIs: 12.5 / 8 = 1.5625. With the real cache CPU3 takes 56.25% more time; the ideal cache would be 1.56 times (56.25%) faster.
3. Stall cycles per instruction = 3 × 1 × 3 = 9; CPI3_no_cache = 8 + 9 = 17. 17 / 12.5 = 1.36: without a cache CPU3 takes 36% more time than with the real cache (the real cache is 1.36 times faster); against the ideal cache, 17 / 8 = 2.125.
Exercise 3 of the 10 June 2025 paper, part 2, in its own words; part 1 is in lesson 3. Write the formula once, compute the stall term on its own line (3 × 0.5 × 3 = 4.5) and give the impact as a ratio of times, which here is the CPI ratio because IC and the clock do not change.
MEMORY HIERARCHY. Let's consider a computer with an L1 and L2 cache memory hierarchy. In 1000 memory references there are 40 misses in L1 and 20 misses in L2. Hit Time L1 = 1 clock cycle; Hit Time L2 = 10 clock cycles; Miss Penalty L2 = 200 clock cycles; 1.5 memory accesses on average for each instruction; CPI = 1.0 with an ideal cache.
1. How much are the L1 miss rate, the L2 local miss rate and the L2 global miss rate? 2. How much is the AMAT? 3. How much are the memory stall cycles per instruction and the CPI? 4. How much is the CPI without the L2 cache (L1 misses served by main memory in 200 clock cycles), and how much is the speed-up due to the L2 cache?
Show model answer
1. Miss Rate L1 = 40 / 1000 = 0.04 (4%); local Miss Rate L2 = 20 / 40 = 0.5 (50%); global Miss Rate L2 = 0.04 × 0.5 = 20 / 1000 = 0.02 (2%).
2. AMAT = 1 + 0.04 × (10 + 0.5 × 200) = 1 + 0.04 × 110 = 5.4 clock cycles.
3. Stall cycles per instruction = 1.5 × (0.04 × 10 + 0.02 × 200) = 1.5 × (0.4 + 4) = 6.6 (check: 1.5 × (5.4 − 1) = 6.6). CPI = 1.0 + 6.6 = 7.6.
4. Without L2: stall cycles per instruction = 1.5 × 0.04 × 200 = 12; CPI = 13 (AMAT = 1 + 0.04 × 200 = 9). Speed-up due to L2 = 13 / 7.6 = 1.71.
The notes' Example 7 (p. 261) with the latencies of Hennessy & Patterson's version of the same example; the no-L2 part is added here. The whole exercise is about which rate goes where: the local 50% inside the bracket of the AMAT, the global 2% in the misses per instruction that reach memory, and no L1 hit time among the stall cycles.
(Single answer.) Let us consider a computer with L1 and L2 caches with the following parameters: Processor Clock Frequency = 1 GHz; Hit Time L1 = 1 clock cycle; Hit Rate L1 = 95%; Hit Time L2 = 5 clock cycles; Hit Rate L2 = 90%; Miss Penalty L2 = 15 clock cycles. How much is the Global Miss Rate for Last Level Cache? Motivate your answer.
Show model answer
Answer 2. Miss Rate L1 = 1 − 0.95 = 0.05. The L2 hit rate of 90% is local, so the L2 misses 0.10 of the accesses that reach it. Global miss rate of the last-level cache (L2) = 0.05 × 0.10 = 0.005 = 0.5%: one access in 200 goes to main memory. The clock and the hit times are not needed.
Question 3 of the 8 January 2026 paper as the notes reproduce it (p. 503); the notes' answer is right. The motivation needs one fact: the 90% is a local hit rate, so the L2 misses 10% of the 5% that reach it.
With the parameters of the previous question, how much is the AMAT, in clock cycles?
Show model answer
AMAT = Hit Time L1 + Miss Rate L1 × (Hit Time L2 + Miss Rate L2 × Miss Penalty L2) = 1 + 0.05 × (5 + 0.10 × 15) = 1 + 0.05 × 6.5 = 1.325 clock cycles (1.325 ns at 1 GHz).
Not asked in the paper, but the same numbers make it the natural next question. The expanded form gives the same: 1 + 0.25 + 0.075. The slip to avoid is the global rate inside the bracket, 1 + 0.05 × (5 + 0.005 × 15) = 1.254.
(Multiple answers.) Which of the following cache improvements are effective in reducing the miss penalty?
Show model answer
Answers 3 and 4. Answer 1 reduces the miss rate (fewer conflict misses). Answer 2 reduces the hit time: the cache is indexed while the TLB translates. Answer 3 makes an L1 miss cost an L2 access instead of a memory access. Answer 4 serves a read miss before the pending writes complete (after checking the write buffer for the same address), so the read waits less.
Question 4 of the 8 January 2026 paper as the notes reproduce it (pp. 503–504). The notes' solution marks 2 and 3: see the red pen in the last section. The options copy, almost word for word, the titles of Hennessy & Patterson's basic cache optimizations, where each title also names the term it reduces.
(Multiple answers.) Which of the following statements about the classification of cache misses (the 3 C's model) are correct?
Show model answer
Answers 1, 2 and 5.
Built in the paper's multiple-answer form. The definitions are Hennessy & Patterson's; the remedies are the notes' Table 28 (p. 320). Answer 4 is the trap of the exam's cache table, where every first touch is a Cold-start Miss.
Explain the main concepts and benefits of each one of the following concepts and techniques of the memory hierarchy: 1. Second-level cache (L2); 2. Local and global miss rate; 3. AMAT of a two-level cache hierarchy; 4. Memory stall cycles and CPU time; 5. Compulsory misses; 6. Capacity misses; 7. Conflict misses; 8. The three strategies to improve cache performance.
Show model answer
1. A larger, slower cache between L1 and main memory (hundreds of KB to MBs, SRAM, usually unified, on chip). It catches L1 misses before they reach DRAM, so the L1 miss penalty becomes Hit Time L2 + Miss Rate L2 × Miss Penalty L2 instead of the memory latency. Benefit: L1 stays small and fast while its misses become cheap (Example 8: AMAT 6 → 2.5 cycles). It does not change the L1 miss rate; it pays off only if its hit time plus its own misses cost less than the trip to memory.
2. Local miss rate = misses of a level / accesses to that level; global miss rate = misses of a level / all CPU accesses; for L2, local = L2 misses / L1 misses and global = Miss Rate L1 × local Miss Rate L2. Example: 1000 accesses, 40 L1 misses, 20 L2 misses → 4%, 50% local, 2% global. The global rate measures the accesses that reach memory and is comparable across hierarchies; the local L2 rate is high because L1 has already served the easy accesses.
3. Nest the one-level formula: AMAT = Hit Time L1 + Miss Rate L1 × Miss Penalty L1, with Miss Penalty L1 = Hit Time L2 + Miss Rate L2 × Miss Penalty L2 (local rate). Expanded: every access pays Hit Time L1, the L1 misses pay Hit Time L2, the misses in both pay Miss Penalty L2. Example: 1 + 0.04 × (10 + 0.5 × 200) = 5.4 cycles, against 9 without L2.
4. CPU time = IC × (CPI_exec + memory stall cycles per instruction) × T_CLK; stall cycles per instruction = memory accesses per instruction × miss rate × miss penalty (misses per instruction × penalty). With L1 and L2: MAPI × (Miss Rate L1 × Hit Time L2 + Miss Rate L1 × Miss Rate L2 × Miss Penalty L2) = MAPI × (AMAT − Hit Time L1). Example: CPU3, 8 + 3 × 0.5 × 3 = 12.5. Benefit: it predicts the effect of the memory system on execution time, and shows that a faster core loses a larger share of its time to the same misses.
5. The first access to a block (cold start); they occur even in an infinite cache. Reduced by larger blocks (one miss brings the neighbours) and by prefetching; larger blocks raise the miss penalty.
6. The working set does not fit, so blocks are evicted and needed again: the misses of a fully associative cache of the same size, minus the compulsory ones. Reduced by a larger cache, at the cost of hit time, area and power.
7. Blocks that map to the same set evict each other although other lines are free: the misses of the real cache minus those of a fully associative cache of the same size. Reduced by higher associativity (more comparators, longer hit time) or a victim cache. Example: blocks 12 and 20 in a direct-mapped cache of 8 blocks, 100% miss rate, against 33% fully associative.
8. From AMAT = Hit Time + Miss Rate × Miss Penalty: reduce the miss rate (larger caches and blocks, higher associativity, prefetching, compiler optimizations), reduce the miss penalty (multilevel caches, priority to read misses over writes, early restart and critical word first, non-blocking caches), reduce the hit time (small and simple L1, avoiding address translation with virtually indexed, physically tagged caches, pipelined writes). Most techniques move two terms (bigger cache: miss rate down, hit time up; bigger block: miss rate down, miss penalty up), so each choice is a trade-off judged on AMAT.
The 2026 paper's form: eight sub-points, about five lines each. A strong sub-point has a definition, the mechanism or formula, a number and the benefit with its cost. Sub-point 2 needs both denominators named; sub-point 4 needs the multiplication by the memory accesses per instruction; sub-points 5–7 are strongest with the comparison caches of the definitions.
Check yourself
In 1000 accesses, L1 misses 50 times and L2 misses 10 times. The L2's local and global miss rates are…
In Example 7 a better L1 now also catches 20 of the 40 accesses that used to reach L2, and the L2 still misses the same 20. What happens to the L2's miss rates?
Cores A and B run the same program at the same clock, behind the same memory system: 0.6 memory stall cycles per instruction. Core A has \(CPI_{exec}\) = 2.0, core B 0.5. Which statement is true?
Blocks 0, 8, 0, 8 are read from an empty cache of 8 blocks. Which statements are true? Select all that apply.
At the same cache size the block size is doubled. What can happen? Select all that apply.
Three effects at once, two of them bad: that is why block size has a sweet spot, measured in lesson 25.
AMAT = 5.4 cycles, \(HT_{L1}\) = 1 cycle, 1.5 memory accesses per instruction. How many memory stall cycles per instruction?
Which term of AMAT does a virtually indexed, physically tagged L1 cache reduce?
Key take-aways
- An L2 catches L1 misses before they reach memory: an L1 miss costs \(HT_{L2} + MR_{L2} \times MP_{L2}\) instead of the trip to memory, and nesting the one-level formula gives the two-level AMAT (Example 8: 6 → 2.5 cycles). It does not change the L1 miss rate.
- A local miss rate divides by the accesses that reach the level, a global one by all CPU accesses; the global L2 rate is \(MR_{L1} \times MR_{L2}\) (Example 7: 4%, 50%, 2%; January 2026: 0.5%). Only the global rate is comparable, and a high local rate at L2 is normal.
- CPU time = IC × (\(CPI_{exec}\) + MAPI × MR × MP) × \(T_{CLK}\): misses per instruction times the penalty, added to the work of the core. June 2025 CPU3: 8, 12.5, 17, impacts 1.5625 and 1.36.
- With two levels the stall cycles per instruction are MAPI × (\(MR_{L1} HT_{L2}\) + \(MR_{L1} MR_{L2} MP_{L2}\)) = MAPI × (AMAT − \(HT_{L1}\)); the same stalls cost a faster core a larger share of its time.
- The 3 C's — not "3 Caches": compulsory misses also happen in an infinite cache, capacity misses also in a fully associative cache of the same size, conflict misses only in your organisation; coherence is the fourth C of multiprocessors.
- The main knobs each move two terms: size (miss rate ↓, hit time ↑), block (miss rate ↓, penalty ↑), ways (miss rate ↓, hit time ↑). The three strategies map lessons 25–28; multilevel caches and read priority reduce the miss penalty, avoiding translation (VIPT) reduces the hit time.
What to watch and read
-
Cache animation (VivioJS)
Jeremy Jones, Trinity College Dublin
After the 3 C's lab: keep the cache size, set the ways to 1 and then 2, and feed the repetitive address stream. The conflict misses of the lab appear and vanish, with the tag–set split and the LRU order animated step by step, forwards and backwards.
-
Venus RISC-V simulator, Cache panel
UC Berkeley CS 61C
Run one loop over an array with a direct-mapped and then a 2-way cache of the same size and watch the hit rate the panel reports. Its cache is write-through with write-allocate.
-
Gallery of Processor Cache Effects
Igor Ostrovsky, 2010
Seven tiny experiments on a real PC. Example 3 shows the L1 and L2 sizes as steps in the access time — capacity misses; Example 5 shows strides that pile onto one set — conflict misses.
-
Aspects of Cache Memory and Instruction Buffer Performance
Mark D. Hill, UC Berkeley, 1987
The thesis that introduced compulsory, capacity and conflict misses; the report page links the scanned PDF (183 pages). Skim it for the original definitions you used in the lab.