• CPU cache memory is a type of temporary data storage located on the processor
  • It is used to increase the processing efficiency of the CPU by holding small, often-requested bits of data ready to be accessed at high speeds
  • Most modern day processors have multi-level caching, namely l1, l2, l3 and optional l4

CPU cache wasn't always a thing

  • The 8008 core (shown in CPU Core) does not have L1 and L2 cache!
  • The 8008 core was introduced in April 1972
  • The concept of caches became mainstream only around 1980s

L1 and L2 Caches

  • Each modern day CPU core has it’s own L1 cache and optional L2 cache
  • Registers are located right next to the ALU
  • L1 is a little father from the ALU than registers, L2 is even farther
  • L1 cache is split,
    • L1i is the instruction cache 
    • L1d is the data cache

Comparison btw registers, L1 cache and L2 cache (off-core)

ParameterRegistersL1 Cache (on-core)L2 Cache (off-core)
Number of CPU cycles to read the value1-24+10+
Typical size1 KB8 - 128 KB256 KB - 8 MB
Managed byCompilerHardwareHardware
TechnologyCMOSSRAMSRAM

L3 cache

  • A shared storage pool that the entire processor can access
  • It’s only twice as fast as the RAM but is bigger than L1 and L2
  • Commonly L3 caches are 32 MB or more in size
  • When first developed, L3 cache was often located in a separate chip on the motherboard. Modern CPUs now almost exclusively have L3 cache onboard for greater efficiency.


Refs

  1. https://www.howtogeek.com/891526/l1-vs-l2-vs-l3-cache/
  2. https://superuser.com/questions/196143/where-exactly-l1-l2-and-l3-caches-located-in-computer?newreg=516a0c2db806497f90431852de07bff7
  3. https://stackoverflow.com/questions/10274355/cycles-cost-for-l1-cache-hit-vs-register-on-x86