The E in MESI, and the exam table
After this lesson you will run the MESI protocol by hand on the exam's one-block caches — every processor's state, the bus transaction and the "Memory up to date?" column — and say in five lines what the Exclusive state buys over MSI and what it costs.
Two processors, one cache block each, and a memory of two blocks. After three rows of the table, P0 and P1 both hold block 0 Shared. Then P0 reads block 1, and since its cache holds a single block, block 0 has to leave. Now P1 holds the only cached copy of block 0 in the whole machine — which is exactly what the Exclusive state of MESI means.
So does P1 become Exclusive? This is row 4 of the MESI exercise of the January 2026 paper, and the solution in the notes says yes. Of the 56 cells the table asks you to fill, it is the only one the notes get wrong. By the end of this lesson you will see why the answer is no — and why, if P1 then writes block 0, it pays for a bus transaction nobody needs: the very waste the E state was invented to remove.
What MSI pays for a private variable
Start from the machine of lesson 35: every cache controller snoops the bus, and a cache line is Modified (the only copy, dirty), Shared (a clean copy that others may also hold) or Invalid. In table form, with the replacement column that every exam table needs:
| State | Processor read | Processor write | Snooped Read Miss | Snooped Write Miss or Invalidate | Replacement |
|---|---|---|---|---|---|
| I | Read Miss → S | Write Miss → M | — | — | — |
| S | hit | Invalidate → M | stays S | → I | → I, silent |
| M | hit | hit | write-back → S | write-back → I | write-back → I |
Now give P0 a loop over an array x that no other processor ever touches:
LOOP: LD F2, 0(R1) ; x[i]
FADD F2, F2, F4 ; + c
SD F2, 0(R1) ; x[i]
ADDUI R1, R1, 8 ; next
BNE R1, R2, LOOP
Assumptions: 64-byte blocks, 8-byte doubles, x private to P0, and P0's cache large enough for all of x.
Follow one block under MSI. The first LD misses: a Read Miss goes on the bus, memory answers, and the block arrives in S — the only state MSI has for a block that was read. The first SD is then a write hit on a Shared line, and Shared means "others may hold a copy". So P0 broadcasts an Invalidate and waits for the bus before the store can complete. Nobody is listening. The other seven LD/SD pairs of the block hit in M.
Two bus transactions per block, one of them useless, and a store that waits for it. The notes sum it up: "MSI wasted both bandwidth (spurious invalidations) and time (delayed private writes)" (p. 458). Nor is this a corner case: stack data, local variables and many heap objects are private to one thread, and the notes call private blocks "the common case" (p. 458).
Before: MSI — a Read Miss, then an Invalidate
After: MESI — the Read Miss only
LD and its first SD. MSI must broadcast an Invalidate before the first write although no other cache holds the block, and the store waits for it; MESI receives the block in E and writes it silently. The other fourteen accesses to the block hit in both.Exclusive: the only copy, and clean
MESI adds one state. A line is Exclusive when this cache holds the only copy and that copy is clean, identical to memory. A read miss lands in E when no other cache holds the block, and in S when one does. The payoff comes at the first write: E goes to M silently, with no bus transaction, because nobody else has a copy to invalidate. The notes call it "the main benefit of MESI over MSI" (p. 458).
Exclusive (E) — the line is valid, clean and present in no other cache; the processor may write it without a bus transaction, and the line becomes Modified.
Seen this way, a state is three yes/no facts about a line: valid, dirty, the only copy. A valid line can be dirty and alone (M), clean and alone (E) or clean and maybe shared (S); add Invalid and there are four states, which still fit in the two state bits per line that MSI already spent on three. The new state costs no storage in the cache.
How does a cache know it is alone?
It cannot find out on its own; it must ask while its own miss is on the bus. During a Read Miss every other cache looks the block up in its tags anyway, to see whether it must react. MESI adds a wire for the answer, the shared line: every snooper that finds the block pulls it high. If the line stays low, the requester takes E. If anyone pulls it, the requester takes S — and an E holder drops to S as well, because it is no longer alone.
No other cache holds X: the line stays low, P0 takes E
P2 holds X in E: P2 pulls the line, P0 takes S and P2 drops to S
So the whole hardware price of E is one bus line and the logic that drives it, and it buys a silent first write to every private block. The same page of the notes also misplaces where the idea came from:
Exclusive = the only copy, and clean: the cache may write it without telling anyone.
The MESI machine, arc by arc
The bus transactions keep the names that lesson 35, the notes and the papers use: a Read Miss; a Write Miss, which fetches the block and invalidates every other copy in one transaction (a read-exclusive); and an Invalidate, sent by a write hit on a Shared line. Other texts write them BusRd, BusRdX and BusUpgr, the processor's own accesses PrRd and PrWr, and a write-back Flush. Here is the MSI table again with what MESI changes:
| State | Processor read | Processor write | Snooped Read Miss | Snooped Write Miss or Invalidate | Replacement |
|---|---|---|---|---|---|
| I | Read Miss → E if no other cache holds the block, else S | Write Miss → M | — | — | — |
| E | hit | → M, no bus transaction | → S, no write-back | → I, no write-back | → I, silent |
| S | hit | Invalidate → M | stays S | → I | → I, silent |
| M | hit | hit | write-back → S | write-back → I | write-back → I |
Read the E row against the S row. A write hit in S needs an Invalidate; in E it needs nothing. A snooped Read Miss leaves S alone but takes E down to S, since the line is no longer the only copy. Everything else matches, and nothing in either row is ever written back: both are clean.
The processor's own reads and writes (solid)
Other processors' transactions seen on the bus (dashed)
Three write-backs, all from M
Memory gets a block back only from a Modified line, and only in three situations (p. 461):
- the line is replaced, because its processor needs the other block: M → I with a write-back;
- another processor's Read Miss for the block is snooped: the owner writes it back and both end in S, so memory is up to date again;
- another processor's Write Miss is snooped: the owner writes back and goes to I, and the new owner writes at once, so memory is stale again.
E, S and I never write back: E and S are clean, and I holds nothing.
"Write-Back policy: data is written to main memory only when it is evicted from the cache." That is how the notes define it on p. 493, and p. 461 ends the same way: "the only time a write-back is needed is when evicting a dirty block in M state". In a coherent machine it is two cases short: a Modified block is also written back when another processor's Read Miss or Write Miss for it is snooped. The snooped Read Miss is the case that turns "Memory up to date?" back to Yes in the middle of a table.
The exam table: one row, six moves
Every MESI exercise of the past papers opens with the same sentence, up to the number of processors. The June 2026 paper (Quiz 7, p. 12): "Let's consider the following access patterns on a 4-processor system with a direct-mapped, write-back cache with one cache block per processor and a two-cache block memory. Assume the MESI protocol is used, with write-back caches, write-allocate, and write-invalidate of other caches."
Three phrases decide the table. One cache block per processor: an access to the other block is a miss that throws the current block out. Write-allocate: a write miss first brings the block into the cache (lesson 23). Write-invalidate: a writer invalidates every other copy. Each row then holds the state of every cache as "state (block)" — Mod (1), Excl (0), Shared (0), or Invalid with no block — and, for each memory block, whether memory holds its latest value.
Here is the hardest kind of row, done slowly: row 2 of January 2026, "P0: write block 0", where P0 holds Excl (1) and P1 holds Mod (0).
Hit or miss? P0's line holds block 1 and P0 wants block 0: a write miss. A hit needs the same block, in a valid state.
Replacement first. P0's
Excl (1)is clean, so it leaves silently: no bus transaction, and memory at bl. 1 stays Yes. Had it beenMod (1), P0 would write block 1 back before anything else.The request. One Write Miss goes on the bus: fetch block 0 and invalidate every other copy.
The others react. P1 holds block 0 Modified, so it writes it back and goes Invalid. On a snooped Read Miss instead, an Excl or Mod copy would drop to Shared (Mod writing back first) and a Shared copy would stay.
The requester's state. A write ends in Mod: P0 takes
Mod (0)directly. A read miss would end in Excl if nobody else held the block, in Shared otherwise.The memory columns. Block 0 is No: P0 holds it Modified. P1's write-back made memory fresh for an instant, and P0's write made it stale again. Block 1 is Yes: nobody holds it Modified. The row reads
Mod (0) | Invalid | No | Yes.
Hits are shorter. A read hit changes nothing. A write hit in Mod changes nothing; in Excl it turns the line into Mod with no bus transaction; in Shared it puts an Invalidate on the bus, every other copy goes Invalid, and the writer goes to Mod.
"Memory at bl. b up to date?" is No exactly while some cache holds block b in Mod, and Yes in every other row.
Copy each row from the one above, then change only the cells the operation can touch: the requester, the other holders of the same block, and the two memory cells.
The February 2025 exercise runs the same moves on four processors; rows 1 and 2 are given in the paper:
| Cycle | After Op. | P0 cache block state | P1 cache block state | P2 cache block state | P3 cache block state | Mem. at bl. 0 up to date? | Mem. at bl. 1 up to date? | On the bus (not asked) |
|---|---|---|---|---|---|---|---|---|
| 1 | P0: Read Bl. 1 | Excl (1) | Invalid | Invalid | Invalid | Yes | Yes | given: Read Miss, no other copy |
| 2 | P2: Read Bl. 0 | Excl (1) | Invalid | Excl (0) | Invalid | Yes | Yes | given: Read Miss, no other copy |
| 3 | P3: Read Bl. 0 | Excl (1) | Invalid | Shared (0) | Shared (0) | Yes | Yes | Read Miss; P2 pulls the shared line, E → S |
| 4 | P1: Write Bl. 0 | Excl (1) | Mod (0) | Invalid | Invalid | No | Yes | Write Miss: P2, P3 → Invalid; P1 I → M |
| 5 | P0: Write Bl. 1 | Mod (1) | Mod (0) | Invalid | Invalid | No | No | nothing: a write hit in Excl |
| 6 | P3: Read Bl. 1 | Shared (1) | Mod (0) | Invalid | Shared (1) | No | Yes | Read Miss; P0 writes block 1 back, M → S |
Row 5 is E paying off: P0 writes block 1 with nothing on the bus. Under MSI, row 1 would have left P0 in Shared and row 5 would have cost an Invalidate. Row 6 also shows what a read of the other block leaves alone: block 0 stays No to the last row, because P1 still owns it and nothing forced a write-back. The notes' walkthrough gets every cell right, but one of its sentences describes the protocol wrongly, and another invites a misreading:
"P3 sees that P2 holds block 0 and asks P2 for a copy." The notes' walkthrough of row 3 reads that way: "a copy of block 0 is in processor 2's cache, so processor 3 can request a copy of it" (p. 565). On a snooping bus the requester does not know who holds a block — that is why it broadcasts. P3 puts a Read Miss on the bus for every cache to see; P2 snoops it, pulls the shared line and drops from Excl (0) to Shared (0). A request sent only to the holders is what a directory adds (lesson 37). Who sends the data changes no cell: in the course's model memory answers when the other copies are clean, and a cache must supply the block only when it holds it Modified, as P0 does in row 6 (some real machines let a clean copy answer too).
The trap at T = 4, and three more
Back to the puzzle. At T = 3 of January 2026 both caches hold Shared (0), and row 4 is "P0: read block 1". The six moves: a read miss; P0's Shared (0) is clean, so it leaves silently; a Read Miss for block 1 that no cache answers, so P0 takes Excl (1). And P1? It snoops the row's only transaction, but that Read Miss is about block 1: nothing on the bus mentions block 0. A silent replacement is silent for everyone, so P1 cannot learn that it is now alone — and the machine has no arc from S to E.
T = 3: P0 and P1 both hold Shared (0)
T = 4: P0 holds Excl (1), P1 still Shared (0)
So the answer to the hook is no: P1 stays Shared (0). A cache can learn that it is alone at one moment only: while its own miss is on the bus. Later it can hear that it is no longer alone, from another cache's miss, but never that the others have gone. The price would arrive if P1 wrote block 0 next: a write hit in S, so it would broadcast an Invalidate that no cache needs — MSI's waste, back for one write (row 6 of the second exercise below does exactly this). MESI accepts that, because avoiding it would mean announcing every clean replacement on the bus: a transaction spent to save, at best, a later one.
Three more cells the tables keep testing:
- A write miss invalidates everybody. Every other copy of the block becomes Invalid, Shared ones included. Line 5 of the June 2026 quiz forgets this; it is in the exam section below.
- A snooped read of a Mod block refreshes memory. The owner writes back and both end Shared, so memory flips to Yes (January 2026, T = 3, 11 and 14).
- A write miss on a Mod block leaves memory stale. The owner writes back, but the new owner writes at once: No (T = 2 and 13).
Why the bus cannot grow
Every row you filled relied on one thing: all caches see every transaction, in one order, on one bus. That is how a requester learns from the shared line whether it is alone, and how two writers are put in order — whoever gets the bus first invalidates the other. It is also why snooping stops scaling. Every miss and every Invalidate goes to all processors, every cache must check its tags against each of them, and the bus carries one transaction at a time with a bandwidth that does not grow with the number of processors (the physical side of this is in lesson 33).
The January 2026 paper asked for this comparison in its Question 1 (the model answer is in the exam section). The skeleton of the answer:
| Snooping | Directory-based | |
|---|---|---|
| Who knows where the copies are | nobody: every cache checks every transaction | one entry per block, at the block's home node |
| A request goes to | all caches, broadcast on the bus | the home, then only the caches holding the block |
| Suited to | small centralized shared-memory multiprocessors (SMP, UMA) | large distributed shared-memory machines (DSM, NUMA) |
| Benefits | simple, low latency; the bus orders the writes for free | no broadcast: traffic follows the actual sharers, so it scales |
| Limit | bus bandwidth and tag checks are shared by every processor added | storage for the entries; every request passes through the home |
The notes' answer puts the reach of snooping at "typically up to 16 or 32" processors (p. 495). Beyond that, each block needs one place that records which caches hold it, so that a request goes only where the copies are. That place is the directory of lesson 37.
Exam-style questions
Exercise 3 — MESI protocol (January 2026 paper, as transcribed in the notes, p. 493). Let's consider the following access patterns on a dual processor system with a direct-mapped, write-back cache with one cache block per processor and a two cache block memory. Assume the MESI protocol is used, with write-back caches, write-allocate, and write-invalidate of other caches. Please complete the following table:
| T | After Operation | P0 cache block state | P1 cache block state | Memory at block 0 up to date? | Memory at block 1 up to date? |
|---|---|---|---|---|---|
| 0 | P0: read block 1 | Excl (1) | Invalid | Yes | Yes |
| 1 | P1: write block 0 | ||||
| 2 | P0: write block 0 | ||||
| 3 | P1: read block 0 | ||||
| 4 | P0: read block 1 | ||||
| 5 | P1: read block 1 | ||||
| 6 | P0: read block 1 | ||||
| 7 | P1: write block 1 | ||||
| 8 | P0: read block 0 | ||||
| 9 | P1: write block 1 | ||||
| 10 | P1: write block 1 | ||||
| 11 | P0: read block 1 | ||||
| 12 | P1: write block 1 | ||||
| 13 | P0: write block 1 | ||||
| 14 | P1: read block 1 |
Show model answer
| T | After Operation | P0 cache block state | P1 cache block state | Memory at block 0 up to date? | Memory at block 1 up to date? |
|---|---|---|---|---|---|
| 0 | P0: read block 1 | Excl (1) | Invalid | Yes | Yes |
| 1 | P1: write block 0 | Excl (1) | Mod (0) | No | Yes |
| 2 | P0: write block 0 | Mod (0) | Invalid | No | Yes |
| 3 | P1: read block 0 | Shared (0) | Shared (0) | Yes | Yes |
| 4 | P0: read block 1 | Excl (1) | Shared (0) | Yes | Yes |
| 5 | P1: read block 1 | Shared (1) | Shared (1) | Yes | Yes |
| 6 | P0: read block 1 | Shared (1) | Shared (1) | Yes | Yes |
| 7 | P1: write block 1 | Invalid | Mod (1) | Yes | No |
| 8 | P0: read block 0 | Excl (0) | Mod (1) | Yes | No |
| 9 | P1: write block 1 | Excl (0) | Mod (1) | Yes | No |
| 10 | P1: write block 1 | Excl (0) | Mod (1) | Yes | No |
| 11 | P0: read block 1 | Shared (1) | Shared (1) | Yes | Yes |
| 12 | P1: write block 1 | Invalid | Mod (1) | Yes | No |
| 13 | P0: write block 1 | Mod (1) | Invalid | Yes | No |
| 14 | P1: read block 1 | Shared (1) | Shared (1) | Yes | Yes |
Bus activity, for checking: Read Miss at T = 0, 3, 4, 5, 8, 11, 14; Write Miss at 1, 2, 13; Invalidate at 7, 12; write-backs at 2, 3, 11, 13, 14; silent replacements at 2, 4, 5, 11; nothing at 6, 9, 10.
Three groups of cells need the most care. T = 4: P1 stays Shared (0), because the silent replacement of P0's clean copy is invisible to it — the notes print Excl(0) there. T = 2 and 13: memory is No although the old owner wrote back, because the new owner writes at once. T = 3, 11 and 14: memory returns to Yes after a snooped read of a Mod block. Write each state as the paper does, state and block in brackets, and Invalid with no block.
Let's consider the following access patterns on a 4-processor system with a direct-mapped, write-back cache with one cache block per processor and a two-cache block memory. Assume the MESI protocol is used, with write-back caches, write-allocate, and write-invalidate of other caches. All caches are initially Invalid. Please complete the following table:
| Cycle | After Operation | P0 cache block state | P1 cache block state | P2 cache block state | P3 cache block state | Memory at bl. 0 up to date? | Memory at bl. 1 up to date? |
|---|---|---|---|---|---|---|---|
| 1 | P0: Read Bl. 0 | ||||||
| 2 | P1: Read Bl. 0 | ||||||
| 3 | P1: Write Bl. 0 | ||||||
| 4 | P2: Read Bl. 0 | ||||||
| 5 | P2: Write Bl. 1 | ||||||
| 6 | P1: Write Bl. 0 | ||||||
| 7 | P1: Read Bl. 1 | ||||||
| 8 | P3: Write Bl. 1 |
Show model answer
| Cycle | After Operation | P0 cache block state | P1 cache block state | P2 cache block state | P3 cache block state | Memory at bl. 0 up to date? | Memory at bl. 1 up to date? |
|---|---|---|---|---|---|---|---|
| 1 | P0: Read Bl. 0 | Excl (0) | Invalid | Invalid | Invalid | Yes | Yes |
| 2 | P1: Read Bl. 0 | Shared (0) | Shared (0) | Invalid | Invalid | Yes | Yes |
| 3 | P1: Write Bl. 0 | Invalid | Mod (0) | Invalid | Invalid | No | Yes |
| 4 | P2: Read Bl. 0 | Invalid | Shared (0) | Shared (0) | Invalid | Yes | Yes |
| 5 | P2: Write Bl. 1 | Invalid | Shared (0) | Mod (1) | Invalid | Yes | No |
| 6 | P1: Write Bl. 0 | Invalid | Mod (0) | Mod (1) | Invalid | No | No |
| 7 | P1: Read Bl. 1 | Invalid | Shared (1) | Shared (1) | Invalid | Yes | Yes |
| 8 | P3: Write Bl. 1 | Invalid | Invalid | Invalid | Mod (1) | Yes | No |
Row 3: write hit in Shared, an Invalidate takes P0 to Invalid. Row 4: P1 writes block 0 back on P2's Read Miss. Row 5: P2's clean Shared (0) leaves silently, so P1 is left as the only holder of block 0 — still Shared. Row 6: P1 therefore broadcasts an Invalidate that nobody needs before going to Mod (0). Row 7: two write-backs in one row — P1 replaces its dirty block 0 (memory at bl. 0 back to Yes), and P2 writes block 1 back on P1's Read Miss. Row 8: the Write Miss invalidates both Shared (1) copies.
A drill in the exact format of the papers, built to contain the two cases their sequences avoid: a lone Shared copy that must still invalidate (row 6) and the replacement of a dirty block (row 7). The exam-table trainer of section 4 produces more drills of this kind (its "random drill").
(June 2026, Question 1) How does a MESI write-invalidate write-back protocol manage a Write Hit on an Exclusive cache block? (MULTIPLE ANSWERS)
Show model answer
Answers 1 and 5. The block is present and clean and no other cache holds it, so the write is performed in the local cache and the state changes from Exclusive to Modified with no bus transaction: nothing is retrieved and nothing is invalidated.
The question tests the one advantage of MESI over MSI. Ticking Answer 4 is the classic mistake: it describes a write hit on a Shared block, which is the next question of the same paper.
(June 2026, Question 7) Let's consider the following access patterns on a 4-processor system with a direct-mapped, write-back cache with one cache block per processor and a two-cache block memory. Assume the MESI protocol is used, with write-back caches, write-allocate, and write-invalidate of other caches.
| Cycle | After Operation | P0 cache block state | P1 cache block state | P2 cache block state | P3 cache block state | Memory at bl. 0 up to date? | Memory at bl. 1 up to date? |
|---|---|---|---|---|---|---|---|
| 0 | P0: write Bl. 1 | Mod (1) | Invalid | Invalid | Invalid | Yes | No |
| 1 | P1: Write Bl. 0 | Mod (1) | Mod (0) | Invalid | Invalid | No | No |
| 2 | P2: Write Bl. 1 | Invalid | Mod (0) | Mod (1) | Invalid | No | No |
| 3 | P3: Read Bl. 0 | Invalid | Shared (0) | Mod (1) | Shared (0) | Yes | No |
| 4 | P0: Read Bl. 1 | Shared (1) | Shared (0) | Shared (1) | Shared (0) | Yes | Yes |
| 5 | P2: Write Bl. 0 | Shared (1) | Shared (0) | Mod (0) | Shared (0) | No | Yes |
Which is the wrong line? (SINGLE ANSWER) Motivate your answer.
Show model answer
Answer 5 (Line 5). P2 holds Shared (1), which it replaces silently (clean). Its write on block 0 is a write miss: the write-invalidate protocol places a Write Miss on the bus and every other copy of block 0 must become Invalid, so P1 and P3 cannot remain Shared (0). P2 ends in Mod (0), memory at bl. 0 is not up to date and memory at bl. 1 is. The correct line is:
| Cycle | After Operation | P0 cache block state | P1 cache block state | P2 cache block state | P3 cache block state | Memory at bl. 0 up to date? | Memory at bl. 1 up to date? |
|---|---|---|---|---|---|---|---|
| 5 | P2: Write Bl. 0 | Shared (1) | Invalid | Mod (0) | Invalid | No | Yes |
The paper leaves an empty row under the motivation lines: that is where the corrected line goes, and writing it is the quickest motivation. Lines 2–4 are the ones that look suspicious and are right — each relies on a write-back that turns the memory column, so check the memory cells with the rule "No exactly while some cache holds the block in Mod".
(January 2026, Question 1, as transcribed in the notes, p. 495) Let's consider the SNOOPING and the DIRECTORY-BASED protocols used to maintain the cache coherence in modern multiprocessor. Answer the following questions: (a) Explain the main characteristics of each protocol. (b) For which type of multiprocessor architecture is each protocol suitable for? (c) What are the main benefits of each protocol? (d) Explain the two types of Snooping protocol depending on what happens on a write operation. (e) What are the possible coherence states of a block in the home directory and the meaning of the sharer bits?
Show model answer
(a) Snooping: the caches share a broadcast medium, usually a bus. Every coherence request (read miss, write miss, invalidate) is broadcast; every cache controller snoops it, checks its own tags and acts locally — it invalidates its copy, writes a dirty copy back or downgrades it. There is no central record of who holds what, and the bus order serialises the writes. Directory-based: for every memory block a directory entry, kept at the block's home node next to its memory, records the coherence state and which caches hold a copy (the sharer bits). A request goes to the home, which sends point-to-point messages only to the caches involved; nothing is broadcast.
(b) Snooping suits small-scale centralized shared-memory multiprocessors (SMP, UMA) built around one bus, up to a few tens of processors. Directories suit large-scale distributed shared-memory machines (DSM, NUMA), where memory is physically distributed over many nodes joined by a point-to-point interconnection network.
(c) Snooping: simple, with no extra structure; low latency, since one broadcast reaches every cache; write serialization for free from the bus. Directory: scalable, because traffic grows with the number of actual sharers, not with the number of processors; it works with physically distributed memory and any interconnect.
(d) Write-invalidate: before writing, the writer broadcasts an invalidate, every other copy becomes Invalid and the writer holds the only copy, so later writes by the same processor cause no traffic (MSI, MESI). It is the dominant choice because it saves bandwidth. Write-update (write-broadcast): every write broadcasts the new value and every cache holding the block updates its copy; readers never miss, but every write costs bus bandwidth, even when nobody reads the block again.
(e) Uncached: no cache holds the block, memory is up to date. Shared: one or more caches hold clean, read-only copies, memory is up to date. Modified: exactly one cache, the owner, holds the block with write permission, and memory may be stale. The sharer bits are one bit per node (N0 N1 N2 N3, left to right): 1 means that node's cache holds a copy, and in Modified exactly one bit is set, naming the owner. They let the home send invalidations and fetches only to the nodes that hold the block, instead of broadcasting.
What a complete answer contains: the broadcast-versus-point-to-point contrast stated as a mechanism, the matching architectures (SMP / UMA against DSM / NUMA), two benefits for each, the two write policies with their trade-off (bandwidth against read latency), and the three directory states with whether memory is fresh in each. The directory half is developed in lessons 37 and 38. The notes' own answer (pp. 495–497) is sound and uses the papers' name, Modified, for the third directory state. Question 2 of the same paper, on dynamic branch prediction, is drilled in lesson 5.
Explain the main concepts and benefits of the MESI protocol with respect to MSI: (1) the four states and their meaning; (2) what happens on a read miss; (3) what happens on a write hit in each valid state; (4) when a block is written back to memory; (5) what the new state buys and what it costs in hardware.
Show model answer
(1) Modified: the only copy, dirty — memory is stale. Exclusive: the only copy, clean — it matches memory. Shared: a clean copy that other caches may also hold. Invalid: no valid copy. MSI has only M, S and I, so after a read miss a block always enters S, even when no other cache holds it.
(2) The miss is broadcast as a Read Miss and every other cache checks its tags. If none holds the block, the requester receives it in Exclusive; if one does, in Shared. A holder in Exclusive drops to Shared; a holder in Modified writes the block back, so memory becomes up to date, and drops to Shared.
(3) In Modified the write proceeds locally, with nothing on the bus. In Exclusive the line becomes Modified silently, with no bus transaction, because no other copy exists. In Shared the cache broadcasts an Invalidate, every other copy becomes Invalid and the line becomes Modified — as in MSI.
(4) Only from Modified: when the line is replaced; when another processor's Read Miss for the block is snooped (M → S); when another processor's Write Miss is snooped (M → I). Exclusive, Shared and Invalid lines are never written back.
(5) Benefit: private data — stack data, local variables, many heap objects — is read and then written by one processor. MSI pays a Read Miss plus a useless Invalidate per block and makes the first write wait for the bus; MESI pays only the Read Miss and writes at once, saving bus bandwidth and write latency. Cost: the requester must learn whether another cache holds the block, so the bus needs a shared line that every snooper holding the block asserts during a read miss; the four states still fit in two state bits per line.
The format of the June 2026 open question ("explain the main concepts and benefits"), applied to this lesson. What a complete answer contains: E defined as exclusive and clean; read miss into E only when no other cache holds the block; E → M without bus traffic; the three write-back cases; the benefit stated as bandwidth and latency on private data; the shared line as the cost.
Check yourself
P0 holds block X in Excl. P1 reads X. What does the row look like afterwards?
P0 and P1 hold block X Shared. P0 replaces X with another block. Then P1 writes X. What does P1 put on the bus?
Which events make a MESI cache write a block back to memory? Select all that apply.
All write-backs come from M: replacement, snooped Read Miss, snooped Write Miss.
What does MESI need in hardware that MSI does not?
P0 holds block 0 in Mod. The next row is "P1: write block 0". What does "Memory at block 0 up to date?" say after it?
A thread reads and then writes each of 10 private blocks, one block after the other; no other processor touches them. How many bus transactions do MSI and MESI need?
Key take-aways
- MSI puts every block that is read into Shared, so the first write to private data broadcasts an Invalidate that nobody needs and waits for it — and private data is the common case.
- MESI adds Exclusive, the only copy and clean: a read miss that no other cache answers lands in E, and E goes to M with no bus transaction. The price is a shared line on the bus, not an extra state bit.
- Only a Modified line is ever written back: when it is replaced, when another processor's Read Miss for it is snooped (M → S) and when a Write Miss is snooped (M → I).
- An exam row takes six moves: hit or miss; replacement first (Mod writes back, Excl or Shared leave silently); the request on the bus; the other holders react; the requester's state (a write gives Mod, a read gives Excl if alone, Shared otherwise); the memory columns, No exactly while some cache holds the block in Mod.
- No arc leads from Shared to Exclusive: a cache can learn that it is alone only while its own miss is on the bus, and clean replacements are silent, so a lone Shared copy stays Shared and still invalidates before writing — the trap at T = 4 of January 2026.
- Snooping works because every cache sees every transaction on one bus, and it stops scaling for the same reason; large machines keep a directory instead.
What to watch and read
-
MSI Cache Coherence Protocol Simulator
IIIT Hyderabad, Virtual Labs
Two processors with PrRd and PrWr buttons and a log of bus activity. Read an address on one processor, then write it, and watch MSI send an Invalidate that no cache needs — the problem this lesson starts from. (It implements MSI only.)
-
MESI animation (VivioJS)
Jeremy Jones, Trinity College Dublin
Three CPUs with small caches: click reads and writes and watch the bus arrows and the state letters change. Careful: in this animation a write to a Shared line is write-through and a write to an Exclusive line is write-back, unlike the pure write-back MESI of the notes and the papers.
-
Computer Architecture — Lecture 20: Cache Coherence (Fall 2021)
Onur Mutlu, ETH Zürich
From the coherence problem to snooping and directories, including the step from MSI to MESI and why Exclusive saves a bus transaction on a private write — a good rehearsal for the open question.
-
A Primer on Memory Consistency and Cache Coherence (2nd edition)
Nagarajan, Sorin, Hill, Wood — open access
The snooping chapters give complete protocol tables, including the transient states that the notes and the exam leave out. For going deeper once the exam drills are automatic.