It's like the memory of things you work on right now

    • CPU caches are pools of memory that store information the CPU is most likely to need next.

    • When the CPU is reading a memory address it first look in the cache for it's data.

    • If the data is in the cache it's called a cache hit and the CPU can move on without accessing main memory.

    • If it's not there the CPU has to wait for it to be revived from main memory. It's called a cache miss. In a cache miss the CPU is more or less idle wasting time doing nothing useful.

    • When reading main memory it will read a chunk of memory, called a cache line and store in the cache. So if the CPU access memory close by to the last there is a bigger chance that the memory is now in the cache.

    • Common cache lines size is often 32 or 64 bytes.

    • There is often more the one cache named from L1, L2 and so on. Lower level cache is faster and smaller then the higher ones and in the end of the cache chain is the main memory.


Memory Barriers: a Hardware View for Software Hackers