hardware//CPU//cache

A CPU cache is a small, fast SRAM that sits between the core and main RAM. It exploits temporal and spatial locality: most programs re-access the same data and nearby addresses repeatedly.


A CPU cache is a small, fast SRAM that sits between the core and main RAM. It exploits temporal and spatial locality: most programs re-access the same data and nearby addresses repeatedly.

It is organized in levels: L1 (per core, about 4 cycles), L2 (per core or shared, about 12 cycles) and L3 (shared across cores, about 40 cycles).

Cache misses stall the pipeline and dominate performance on memory-bound workloads.

The same principle appears in cache (disk-level) and cache (CDN and proxy level), at a different latency scale.