silicon atlasTHE HARDWARE REFERENCE
العربية
Reference/Memory & storage
Memory & storage

Cache coherence & ownership

Keep cached copies of a memory location consistent across processors.

A write can require ownership of an entire cache line.
Line state

Tracks permission and modification.

LIVE EXPERIMENT

Make a cache miss

Runs on your device
BYTE ADDRESS0Block 0 → Set 0MISS
SET 0tag 0
SET 1·
SET 2·
SET 3·
SET 4·
SET 5·
SET 6·
SET 7·
Accesses1
Hit rate0%
Bytes fetched64
Select any access above, or step through the trace.

A cache fetches a whole line. Locality reuses it; conflicting mappings can evict useful data even before total capacity is exhausted.

What this model includes

One read-only cache, 64-byte lines, LRU replacement, eight total lines, eight-byte elements, 32 accesses. No prefetching or multilevel effects.

FOLLOW THE MECHANISM

What happens inside

1

Track shared copies

A coherent system tracks where a line is cached and whether a copy is modified. MESI-like protocols use states such as modified, exclusive, shared, and invalid; real protocols add details. A writer obtains permission and may invalidate other copies. A modified owner may supply data without DRAM.

2

Distinguish ordering from agreement

Coherence governs copies of a location; consistency defines allowed ordering across operations and locations. Store buffers and relaxed ordering can make writes become visible later than source order suggests. Correct synchronization requires the language and hardware memory models together.

PUT IT TO WORK

What this means for your code

Low-level engineer

Use atomic and barrier primitives with the intended scope. Cache coherence alone does not provide a happens-before relation in a language.

Software developer

Reduce cross-thread writable sharing. Even correct atomic operations can generate expensive coherence traffic under contention.

GO TO THE SOURCE

Read the actual specifications

These references supply the underlying contracts and implementation details. The diagrams here are simplified teaching models.

Linux · Memory barriersLinux kernel documentation
Intel · Optimization reference manualsIntel

Keep following the connection

Understood the idea? Keep a note of your progress.