Memory barriers

Cache coherence

L1 caches always have the most up-to-date data. In case of memory write-back the memory (and L3 cache) may have old data.

MESI protocol

Each cache line load/store follows a finite state machine. There are 4 main states M, E, S, I. Other states like O(owner) and F(forward) are optimisations to reduce bus contention and for NUMA sockets interconnect.

CPU_Memory_Barriers.svg CPU_Coherence_Bus_Snoop.svg CPU_Coherence_Directory.svg