Multicore · private caches
A private cache is fast only if every core agrees which copy is valid.
Coherence tracks ownership and visibility for each cache line. Snooping controllers observe transactions, invalidate stale copies, and move the newest data without asking software to repair the view.
Core A’s write upgrades X from S to M, invalidates Core B’s copy, and makes the private owner responsible for the newest value.
- 1
Core A reads X and caches a clean copy.
- 2
Core B reads X and also caches a clean copy.
- 3
Core A writes X, making its local value newer.
- !
Without coherence, Core B could keep and read stale X.
MESI transition explorer
Keep one address coherent across two private caches.
Model: two private caches, one line, and one backing memory level. Each action completes its transaction before the next begins. Transient states, overlapping requests, invalidation acknowledgements, and evictions are omitted. “Current” describes this backing level, not necessarily DRAM in a multilevel cache hierarchy.
Neither private cache holds X. Memory owns the current copy.
Protocol invariants
States are an encoding of who may read, who may write, and who owns the newest data.
In MESI, M or E excludes every peer’s valid copy, including Shared copies. A Shared writer must invalidate peers before gaining write permission.
Every observer must see a value consistent with the ordered coherence transaction for that line.
MESI M and MOESI M/O mark memory stale; intervention or writeback supplies the current data.
| Protocol | States | Key addition | Private clean write | Read of dirty peer | Tradeoff |
|---|---|---|---|---|---|
MSI | M · S · I | Basic invalidation coherence | Needs an ownership transaction because there is no Exclusive state | Modified owner must supply or flush the newest data | Simple, but generates extra traffic for private data |
MESI | M · E · S · I | Exclusive marks one clean private copy | Silent E → M transition | Modified owner relinquishes dirty ownership; implementations may forward while updating coherence state | Common balance of private-write efficiency and complexity |
MOESI | M · O · E · S · I | Owned permits dirty shared data | Silent E → M transition | Owner can forward dirty data directly while memory remains stale | Less writeback pressure, more controller and verification complexity |
S + local write: request ownership, invalidate sharers, then enter M.
E + local write: enter M silently. E + remote read: both copies become S.
M + remote read: supplier may enter O while the requester enters S and memory remains stale.
Propagate writes to the next memory level.
Each write is also sent toward the next level, possibly through a write buffer; this does not mean DRAM changes immediately. Peer copies still need invalidation or update. Buffering can hide latency; reducing traffic requires coalescing or another optimization.
Keep the newest data in the owning cache.
Writes avoid immediate lower-level traffic, but the protocol must identify the dirty owner and make it supply or write back data when another requester arrives.
Core A has E; Core B now reads the same line. What happens?
Core B issues a read transaction. Core A snoops it and downgrades from Exclusive to Shared because it is no longer the only holder. Core B receives a clean Shared copy, so the final state is S/S. Since the original E line matched memory, no dirty-data recovery is required.
How do write-through and write-back differ under coherence?
Write-through sends each write toward the next memory level, possibly through a buffer, while write-back lets an M or O cache remain the newest owner. Both still need a protocol for other cached copies. Write-through simplifies finding a current lower-level copy at the cost of traffic; write-back reduces traffic at the cost of ownership, intervention, and eviction logic.
Put it into practice
Explain the mechanism. Test your reasoning.
Use the experiment above to support your answer, then apply the idea in the question bank.
You reached the final chapter
Bring the mechanisms together.
Use the question bank to connect pipelines, speculation, memory, and coherence in one explanation.

