MEMORY HIERARCHY SIMULATION

A register read costs about one cycle while a trip out to disk costs on the order of a hundred thousand, five orders of magnitude apart, and the whole cache tower exists only because of that gap: L1 around 4 cycles, L2 around 12, L3 around 40, RAM around 200. A cache never fetches a lone byte but pulls in a whole 64-byte line, so walking an array in order lets one miss pay in advance for many hits right behind it. A hot loop working over a small set hits almost every time, whereas addresses scattered randomly across memory miss almost every time and the average latency creeps up toward RAM speed.

▸ Building the pyramid: registers · L1 · L2 · L3 · RAM · disk…
▸ Loading real latencies (≈1 → millions of cycles)
▸ Initializing the cache & LRU eviction policy
▸ Generating access patterns (sequential · scattered · hot loop)
▸ Calibrating hit / miss counters & average latency…
▸ Ready — Online. ✅
0%
⌂ Mind & Machine

Simulation room Memory hierarchy & Cache

Memory Hierarchy
Online
hit/miss · locality · latency
Hit rate & latency
🎲 Mixed access
Accesses—
Hits L1·L2·L3—
Misses (→RAM)—
Hit rate—
Avg latency—
Served from—
Notes
A computer arranges memory into many tiers: the closer to the CPU, the faster but smaller & pricier. The cache keeps copies of hot data so most accesses hit a fast tier; only a small fraction must go to RAM/disk. Whether a program is fast or slow depends on the locality of its accesses.
—
Pick a "Scenario" to change the access PATTERN (sequential · scattered · hot loop · too large · cold) · watch the packet descend to find data (hit=green, miss=red) · click a tier/concept for details
Your browser has canvas disabled.
Hit rate & average latency over time hit rateavg latency
About Memory Hierarchy

A register read costs about one cycle while a trip out to disk costs on the order of a hundred thousand, five orders of magnitude apart, and the whole cache tower exists only because of that gap: L1 around 4 cycles, L2 around 12, L3 around 40, RAM around 200. A cache never fetches a lone byte but pulls in a whole 64-byte line, so walking an array in order lets one miss pay in advance for many hits right behind it. A hot loop working over a small set hits almost every time, whereas addresses scattered randomly across memory miss almost every time and the average latency creeps up toward RAM speed.

Related topics in Mind & Machine