CPU - CPU Cache (L1, L2, L3)

> Computer System > Computer - Central processing unit (CPU)

1 - About

A CPU cache is a cache used by the central processing unit of a computer to reduce the average time to access memory.

When the processor needs to read from or write to a location in main memory, it first checks whether a copy of that data is in the cache. If so, the processor immediately reads from or writes to the cache, which is much faster than reading from or writing to main memory.

See Memory - Hierarchy

Advertising

3 - Type of CPU cache

Most modern desktop and server CPUs have at least three independent caches:

  • an instruction cache to speed up executable instruction fetch,
  • a data cache to speed up data fetch and store,
  • and a translation lookaside buffer used to speed up virtual-to-physical address translation for both executable instructions and data.

4 - Level

L3 caches are almost always shared amongst cores; L2 and L1 might also be shared.

4.1 - L1

Level 1 (L1) cache is the primary cache – often accessed in just a few cycles, usually tens of kilobytes. The L1-cache is the fastest cache and it usually comes within the processor itself.

The L1 cache uses the high-speed SRAM (static RAM) instead of the slower and cheaper DRAM (dynamic RAM) used for main memory.

4.2 - L2

Level 2 (L2) cache – higher latency than L1 by 2× to 10×, often 512 KiB or more.

L2 cache comes between L1 and the main memory and is bigger than the L1 cache.

4.3 - L3

Level 3 (L3) cache – higher latency than L2, often 2048 KiB or more.

L3 caches are found on the motherboard rather than the processor. It is kept between RAM and L2 cache.

Advertising

5 - Documentation / Reference

computer/cpu/cpu_cache.txt · Last modified: 2019/01/03 21:58 by gerardnico