wire / wire-format / mesi-protocol
MESI is a cache coherence protocol for multi-core systems. Four states: Modified (M): line is dirty and exclusive to this cache. Exclusive (E): line is clean and exclusive. Shared (S): line is clean and may be in other caches. Invalid (I): line is not valid. State transitions on read/write/hit/miss/snoop. Bus snooping: caches monitor (snoop) the bus for writes to shared lines.
aka: MESI cache coherence protocol
spec: MESI (cache coherence)
MESI is a cache coherence protocol for multi-core systems. Four states: Modified (M): line is dirty and exclusive to this cache. Exclusive (E): line is clean and exclusive. Shared (S): line is clean and may be in other caches. Invalid (I): line is not valid. State transitions on read/write/hit/miss/snoop. Bus snooping: caches monitor (snoop) the bus for writes to shared lines.
| field | size | meaning |
|---|---|---|
| Modified (M) | state | Line is dirty (modified) and exclusive to this cache. Must write back on eviction. No other cache has it. |
| Exclusive (E) | state | Line is clean and exclusive to this cache. No other cache has it. Can transition to M on write (no bus transaction needed). |
| Shared (S) | state | Line is clean and may be in other caches. Read-only. Must invalidate others on write (transition to M). |
| Invalid (I) | state | Line is not valid. Must fetch from memory or another cache on access. |
| Read hit (M/E/S) | transition | M: stay M. E: stay E. S: stay S. |
| Read miss (I) | transition | I -> S (if other caches have it) or I -> E (if no other cache has it). |
| Write hit (M) | transition | M: stay M. |
| Write hit (E) | transition | E -> M (no bus transaction). |
| Write hit (S) | transition | S -> M (invalidate other caches). |
| Write miss (I) | transition | I -> M (fetch and invalidate others). |
| Snoop (read) | transition | M -> S (write back first). E -> S. S: stay S. |
| Snoop (write) | transition | M -> I (write back). E -> I. S -> I. |
example:
00 00 00 00
MESI states (placeholder)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/mesi-protocol
or /wire-format/mesi-protocol.json