5.4.17 · D3Memory Hierarchy & Caches

Worked examples — Prefetching strategies

2,344 words11 min readBack to topic

This is the practice deck for the parent topic. The parent built the tools: coverage , accuracy , effective miss rate , and AMAT. Here we drill them across every case a problem can throw at you — good cases, harmful cases, degenerate cases, and the exam trick that catches people.

Everything below only uses symbols the parent defined. Quick reminder, in plain words:


The scenario matrix

Every prefetching problem lives in one of these cells. The examples afterwards each name the cell they cover, so by the end no cell is left blank.

Cell What makes it special Sign/limit stress point Example
A. Clean win good coverage, no pollution , large Ex 1
B. Net loss low coverage + pollution , small Ex 2
C. Break-even benefit exactly cancels pollution solve for the tipping Ex 3
D. Degenerate: prefetcher does nothing limit Ex 4
E. Degenerate: prefetcher kills all misses limit Ex 5
F. Stride geometry learn a stride, place lines ahead negative stride included Ex 6
G. Accuracy trap given but must NOT be multiplied in separate from Ex 7
H. Real-world word problem bandwidth budget from accuracy wasted-fetch counting Ex 8
I. Exam twist irregular / pointer chase, no stride stride prefetch = 0 coverage Ex 9

Worked examples


Recall Self-test: which cell?

A prefetcher has and on . Better or worse than baseline? ::: Worse. Break-even ; here , so it's Cell B (net loss). . Why don't we ever write ? ::: Because coverage already counts only misses actually eliminated (correctness + timeliness baked in). Multiplying by accuracy double-counts. belongs to bandwidth math (Ex 8), not . A descending address walk 2016,1984,1952 — sign of stride? ::: Negative (). Prefetches go backward; distance ahead uses .

See also: Cache Basics — Blocks and Locality, Spatial vs Temporal Locality, Cache Pollution and Replacement Policies, Out-of-Order Execution.