← ⚡ Cache Memory
Subtopic 9 of 9

3.9Multi-level cache

The idea

A multi-level cache puts a small fast L1 in front of a bigger slower L2. The average access time adds the penalties level by level.

Think of it like this: Check your pocket first (L1), then your bag (L2), then go home (memory).

Why it exists

One cache cannot be both very fast and very large; two levels give nearly the speed of the small one and the hit rate of the big one.

How it works

  1. Every access pays t1 (L1 lookup).
  2. Only on an L1 miss do we also pay t2.
  3. Only if L2 also misses do we pay memory time.
  4. AMAT = t1 + m1 × (t2 + m2 × t_mem).

Worked example: t1 = 2, h1 = 0.9, t2 = 10, h2 = 0.8, tmem = 100

AMAT = 2 + 0.1 × (10 + 0.2 × 100) = 2 + 0.1 × 30 = 5 ns.

Now play with it

  • →Click the three tabs to see which levels are visited and the running time.
  • →Change the hit ratios in the calculator and watch AMAT respond.
CPU-
L1-
L2-
Memory-
Time so far0
  • CPU sends the address to L1
  • L1 lookup costs t1: HIT, data returned. AMAT contribution = t1
Hierarchical AMAT (ns)5
Simultaneous AMAT (ns)4.6
Global miss rate0.02

Hierarchical: t1 + m1(t2 + m2·tm). Simultaneous: h1t1 + (1−h1)h2t2 + (1−h1)(1−h2)tm. Use the one the question wording implies.

Check yourself

t1 = 2 ns, h1 = 0.9, t2 = 10 ns, h2 = 0.8, memory 100 ns (hierarchical). What is AMAT?

Remember: AMAT = t1 + miss1 × (t2 + miss2 × t_mem).
Exam notes (the dense version)

L1 small & fast, L2 bigger & slower. Local miss rate of L2 is relative to L2 accesses; global = product.

Previous year questions: Cache Memory (22)

PYQs are grouped by topic, so this is the full set for Cache Memory; try the ones that match this subtopic. Open all 22 on the topic page.