Field Guide · hardware

Also known as: CPU cache

Cache memory is a small, very fast memory close to the CPU that keeps recently and frequently used data and instructions on hand, hiding the latency of slower main memory.1

on-chip cache · SRAM CPU L1tiny L2bigger L3shared RAMlarge · slow hit → return miss → try the next level out fast & small near the core · large & slow further out
Cache bridges the speed gap between the fast CPU and slow RAM. A hit in L1 returns almost instantly; a miss walks outward — L2, L3, then RAM — each level larger but slower. Locality of reference is what keeps most accesses in the small, fast levels.

Overview

Caches are usually built from fast SRAM on the processor die and arranged in levels: a tiny, fastest L1 per core, a larger L2, and a big shared L3. When the CPU needs data, a cache hit serves it immediately; a cache miss forces a slow trip to RAM over the system bus. Caches work because programs show locality of reference — they tend to reuse the same data and access nearby addresses — so a small store captures most accesses.

Where it fits

Cache exists because main memory cannot keep up with clock speed: without it, a fast CPU would stall waiting on RAM. It sits between the registers and main memory in the broader memory hierarchy. For throughput-heavy code like GopherTrunk’s streaming DSP, keeping the hot working set — filter taps, buffers — inside cache is what lets the processor sustain its rate instead of stalling on memory.

Sources

  1. CPU cache — Wikipedia, on cache levels, hits and misses, and locality. 

See also