5.4.10 · D3Memory Hierarchy & Caches

Worked examples — Average memory access time (AMAT)

2,526 words11 min readBack to topic

The scenario matrix

Every AMAT problem is one (or a blend) of these cells. Each worked example below is tagged with the cell it lands on.

Cell What makes it special Example
A. Baseline single-level plain , ordinary numbers Ex 1
B. Degenerate perfect cache, never misses Ex 2
C. Degenerate every access misses (limiting worst case) Ex 2
D. Unit mismatch all terms of the formula must share ONE unit before you combine — mixing cycles and ns is the classic trap Ex 3
E. Two-level nesting (local rates) penalty of L1 = AMAT of L2 Ex 4
F. Global-vs-local trap given global rate, must convert Ex 5
G. Solve backwards AMAT known, find the unknown or Ex 6
H. Real-world word problem translate a story into the formula Ex 7
I. Exam twist — design tradeoff bigger cache lowers but raises ; which wins? Ex 8

We'll walk them in order. Every numeric answer here is machine-checked in the verify block.


The picture that runs the whole page

Figure 1 — Anatomy of AMAT.

Figure — Average memory access time (AMAT)

Look at the split in Figure 1: every access pays the flat green "hit" bar on the left. Only the fraction of accesses continues into the long coral "penalty" bar. AMAT is the green bar plus the coral bar scaled down by . Keep this image in mind — every example is just choosing numbers for those two bars.


The worked examples








Figure — Average memory access time (AMAT)

Figure 2 makes Ex 8 visible: Cache B's green (hit) bar is taller, but its coral (penalty) bar shrinks far more — the total stack is shorter.


Recall

Recall Cover and answer

When , AMAT equals what? ::: Exactly the hit time (the lower end of the band). When , AMAT equals what? ::: — the worst case, every access pays both (the upper end). AMAT is always bounded between which two values? ::: . Given global L2 miss rate and , how to get local L2 rate? ::: Divide: . In Ex 8, why did the bigger, slower cache still win? ::: The penalty it saved ( ns) exceeded the extra hit time it cost ( ns).


Connections