CPUcaches
CPU caches are small, fast storage near a central processing unit that hold copies of recently used data and instructions. They reduce latency by exploiting temporal and spatial locality, allowing the processor to avoid frequent accesses to slower main memory. Modern processors implement several cache levels, often with separate L1 data and L1 instruction caches, a larger L2, and a shared or private L3 cache. Some also include an L4 level.
Caches organize memory in lines, typically 64 bytes, and in a set-associative structure. A request checks the
In multi-core systems, caches must stay coherent. Protocols like MESI track line states to ensure visibility
Cache performance depends on size, associativity, and latency, as well as software locality. Compilers and developers