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:

MSI, the starting point: what each event does to one cache line — the transaction this cache puts on the bus, if any, then → the new state. "Snooped" means a transaction of another processor seen on the bus.
StateProcessor readProcessor writeSnooped Read MissSnooped Write Miss or InvalidateReplacement
IRead Miss → SWrite Miss → M———
ShitInvalidate → Mstays S→ I→ I, silent
Mhithitwrite-back → Swrite-back → Iwrite-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).

I S M LD SD bus Read Miss Invalidate the SD waits

Before: MSI — a Read Miss, then an Invalidate

I E M LD SD bus Read Miss no bus, no wait

After: MESI — the Read Miss only

Fig. 1. One block of x, its first 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.

One loop, two protocols: counting the bus transactions

P0 runs the loop above over its private array x, eight doubles per block. Two lanes show P0's copy of every block of x after the accesses so far: MSI on top, MESI below. A filled dot under a block is one bus transaction for that block, a ring is a store that had to wait for the bus. Step one access, one block or the whole loop at a time; the last control changes the access pattern.

  1. Pattern "read, then write" with 4 blocks. Before pressing anything: how many bus transactions will each protocol need for the whole loop, and how many stores will wait? Then press "Whole loop".
    What you should see

    MSI 8 (four Read Misses and four Invalidates) against MESI 4 (the four Read Misses); 4 stores waited under MSI, none under MESI. One extra state removed one bus transaction per block — the Invalidate that nobody needed.

  2. Press "Start over" and step through block 0 with "Next access". After access 1 the two lanes already show different letters: which ones? And at which access do their bus counts first differ?
    What you should see

    After access 1, the first LD x[0]: S in the MSI lane, E in the MESI lane, and one dot (the Read Miss) in each. The counts part at access 2, the first SD x[0]: under MSI the block goes S → M with a second dot and a ring — an Invalidate, and the store waits; under MESI it goes E → M with no mark at all. Accesses 3 to 16 of the block are hits in both lanes.

  3. Switch to "read only", then to "write only". Does MESI still save anything?
    What you should see

    No. Read only: one Read Miss per block in both lanes — the block lands in E instead of S, but it is never written, so E has nothing to save. Write only: one Write Miss per block in both, because a write miss goes from I straight to M. The saving needs a read before the first write.

  4. Choose "after P1 has read x" and predict the counts for 4 blocks.
    What you should see

    8 and 8. P1 holds every block, so P0's Read Miss finds another copy: the block arrives in S under both protocols, and the first write must invalidate P1's copy in both. E is a bet on private data, and it pays only when the data really is private.

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.

M E S I Modified Exclusive Shared Invalid valid dirty only copy memory fresh — — No Yes Yes — the new state
Fig. 2. The four states of Table 33 (p. 459) as three yes/no facts about a line; a filled dot is a guaranteed "yes". An S line may happen to be the last copy, but nothing guarantees it, so its "only copy" dot stays empty. E differs from M in one fact only (clean, so memory is fresh) and from S in one fact only (it is surely the only copy).

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.

P0 P1 P2 E I I Read Miss X bus shared line nobody pulls it

No other cache holds X: the line stays low, P0 takes E

P0 P1 P2 S I S Read Miss X bus shared line P2 pulls it

P2 holds X in E: P2 pulls the line, P0 takes S and P2 drops to S

Fig. 3. The one wire MESI adds to the bus. While P0's Read Miss for block X is on the bus, every snooper looks X up in its tags anyway, and one that finds it pulls the shared line. Whether the line went up is all P0 needs to choose between E and 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:

MESI: the MSI table plus the E row (highlighted); the cell of the I row that changes is in bold.
StateProcessor readProcessor writeSnooped Read MissSnooped Write Miss or InvalidateReplacement
IRead Miss → E if no other cache holds the block, else SWrite Miss → M———
Ehit→ M, no bus transaction→ S, no write-back→ I, no write-back→ I, silent
ShitInvalidate → Mstays S→ I→ I, silent
Mhithitwrite-back → Swrite-back → Iwrite-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.

I S E M Read Miss, shared = 1 Read Miss, shared = 0 Write Miss Write Hit / Invalidate Write Hit / no bus

The processor's own reads and writes (solid)

I S E M Read Miss / write-back Write Miss / write-back Write Miss, Invalidate Write Miss Read Miss

Other processors' transactions seen on the bus (dashed)

Fig. 4. The MESI machine of one cache line — the notes' Fig. 39 (p. 460) with its duplicate I merged — split by who causes each transition. Each label names the event as Fig. 39 does, and after a slash comes what this cache does about it; the arcs leaving E and M drop Fig. 39's "Inv." (margin note below). On the left the event is the processor's own access and its outcome: in lesson 35's notation these arcs read PrRd / Read Miss (to S or E, as the shared line says), PrWr / Write Miss, PrWr / Invalidate and PrWr / —. Not drawn: hits that change nothing, a snooped Read Miss in S (it stays S), and replacement, which takes every state to I and writes back only from M.

Three write-backs, all from M

Memory gets a block back only from a Modified line, and only in three situations (p. 461):

  1. the line is replaced, because its processor needs the other block: M → I with a write-back;
  2. 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;
  3. 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).

  1. 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.

  2. Replacement first. P0's Excl (1) is clean, so it leaves silently: no bus transaction, and memory at bl. 1 stays Yes. Had it been Mod (1), P0 would write block 1 back before anything else.

  3. The request. One Write Miss goes on the bus: fetch block 0 and invalidate every other copy.

  4. 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.

  5. 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.

  6. 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:

February 2025, Exercise 3 (notes, pp. 562–566), recomputed: it agrees with the notes in every cell. The last column is not part of the paper's table.
CycleAfter Op.P0 cache block stateP1 cache block stateP2 cache block stateP3 cache block stateMem. at bl. 0 up to date?Mem. at bl. 1 up to date?On the bus (not asked)
1P0: Read Bl. 1Excl (1)InvalidInvalidInvalidYesYesgiven: Read Miss, no other copy
2P2: Read Bl. 0Excl (1)InvalidExcl (0)InvalidYesYesgiven: Read Miss, no other copy
3P3: Read Bl. 0Excl (1)InvalidShared (0)Shared (0)YesYesRead Miss; P2 pulls the shared line, E → S
4P1: Write Bl. 0Excl (1)Mod (0)InvalidInvalidNoYesWrite Miss: P2, P3 → Invalid; P1 I → M
5P0: Write Bl. 1Mod (1)Mod (0)InvalidInvalidNoNonothing: a write hit in Excl
6P3: Read Bl. 1Shared (1)Mod (0)InvalidShared (1)NoYesRead 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 exam table, row by row

Pick an exercise. The table has the paper's columns plus two the paper does not ask for, Bus transaction and Write-back (behind the dashed border): fill them too, they are where the reasoning shows. The highlighted row is yours — set its cells and press "Check this row": right cells turn green, wrong ones red, with a hint under the controls; a right row is entered and explained. The picture shows the machine after the last entered row: each processor with its one-block cache, the bus with the row's transaction, and memory, where a dashed outline marks a block whose latest value is in memory.

  1. January 2026: fill rows 1–3, or let "Fill it for me" do it. Before checking row 4 (P0: read block 1), decide P1's state.
    What you should see

    Shared (0). P0's copy of block 0 was clean and left silently, so P1 never hears of it, and no arc leads from S to E. P0 takes Excl (1): its Read Miss found no other holder of block 1. The notes print Excl(0) for P1 here.

  2. Still in January 2026, before going on: in which rows will "Memory at block 1 up to date?" read No? Then fill the table and compare.
    What you should see

    Rows 7–10 and 12–13: exactly the rows in which P1 or P0 holds block 1 in Mod. The column returns to Yes at rows 11 and 14, when a Read Miss forces the owner to write back; the write hits in Mod of rows 9 and 10 change nothing.

  3. February 2025, row 5 (P0: Write Bl. 1): predict the Bus transaction cell before checking.
    What you should see

    "—", nothing: P0 holds Excl (1), and a write hit in Excl goes to Mod silently. In row 4, by contrast, P1's write miss needs one Write Miss, which also invalidates P2 and P3: one transaction, Invalid straight to Mod.

  4. June 2026 quiz, "Which is the wrong line?": fill lines 1–5 yourself. After each line the widget holds yours against the one printed in the paper and outlines in red the cells where they differ. Before you start: which line will light up, and in which cells?
    What you should see

    Line 5, in P1 and P3: P2's write miss on block 0 must invalidate their Shared (0) copies, so both are Invalid. P2's own Shared (1) leaves silently, and memory reads No, Yes — those cells of the printed line are right. Lines 1–4 agree with yours.

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.

P0 P1 S (0) S (0) bl. 0 Yes bl. 1 Yes bus

T = 3: P0 and P1 both hold Shared (0)

P0 P1 E (1) S (0) bl. 0 Yes bl. 1 Yes Read Miss bus nobody told P1

T = 4: P0 holds Excl (1), P1 still Shared (0)

Fig. 5. The trap of row 4. P0's copy of block 0 is clean, so replacing it costs no bus transaction — and so nobody hears of it. The only transaction of the row is P0's Read Miss for block 1, which no cache answers: P0 takes Excl (1). P1 holds the last copy of block 0 but stays 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:

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 against directory-based coherence, as the open question wants it. The directory column is the subject of lessons 37 and 38; the two kinds of machine, UMA and NUMA, are those of lesson 34.
SnoopingDirectory-based
Who knows where the copies arenobody: every cache checks every transactionone entry per block, at the block's home node
A request goes toall caches, broadcast on the busthe home, then only the caches holding the block
Suited tosmall centralized shared-memory multiprocessors (SMP, UMA)large distributed shared-memory machines (DSM, NUMA)
Benefitssimple, low latency; the bus orders the writes for freeno broadcast: traffic follows the actual sharers, so it scales
Limitbus bandwidth and tag checks are shared by every processor addedstorage 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:

TAfter OperationP0 cache block stateP1 cache block stateMemory at block 0 up to date?Memory at block 1 up to date?
0P0: read block 1Excl (1)InvalidYesYes
1P1: write block 0
2P0: write block 0
3P1: read block 0
4P0: read block 1
5P1: read block 1
6P0: read block 1
7P1: write block 1
8P0: read block 0
9P1: write block 1
10P1: write block 1
11P0: read block 1
12P1: write block 1
13P0: write block 1
14P1: read block 1
Show model answer
TAfter OperationP0 cache block stateP1 cache block stateMemory at block 0 up to date?Memory at block 1 up to date?
0P0: read block 1Excl (1)InvalidYesYes
1P1: write block 0Excl (1)Mod (0)NoYes
2P0: write block 0Mod (0)InvalidNoYes
3P1: read block 0Shared (0)Shared (0)YesYes
4P0: read block 1Excl (1)Shared (0)YesYes
5P1: read block 1Shared (1)Shared (1)YesYes
6P0: read block 1Shared (1)Shared (1)YesYes
7P1: write block 1InvalidMod (1)YesNo
8P0: read block 0Excl (0)Mod (1)YesNo
9P1: write block 1Excl (0)Mod (1)YesNo
10P1: write block 1Excl (0)Mod (1)YesNo
11P0: read block 1Shared (1)Shared (1)YesYes
12P1: write block 1InvalidMod (1)YesNo
13P0: write block 1Mod (1)InvalidYesNo
14P1: read block 1Shared (1)Shared (1)YesYes

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:

CycleAfter OperationP0 cache block stateP1 cache block stateP2 cache block stateP3 cache block stateMemory at bl. 0 up to date?Memory at bl. 1 up to date?
1P0: Read Bl. 0
2P1: Read Bl. 0
3P1: Write Bl. 0
4P2: Read Bl. 0
5P2: Write Bl. 1
6P1: Write Bl. 0
7P1: Read Bl. 1
8P3: Write Bl. 1
Show model answer
CycleAfter OperationP0 cache block stateP1 cache block stateP2 cache block stateP3 cache block stateMemory at bl. 0 up to date?Memory at bl. 1 up to date?
1P0: Read Bl. 0Excl (0)InvalidInvalidInvalidYesYes
2P1: Read Bl. 0Shared (0)Shared (0)InvalidInvalidYesYes
3P1: Write Bl. 0InvalidMod (0)InvalidInvalidNoYes
4P2: Read Bl. 0InvalidShared (0)Shared (0)InvalidYesYes
5P2: Write Bl. 1InvalidShared (0)Mod (1)InvalidYesNo
6P1: Write Bl. 0InvalidMod (0)Mod (1)InvalidNoNo
7P1: Read Bl. 1InvalidShared (1)Shared (1)InvalidYesYes
8P3: Write Bl. 1InvalidInvalidInvalidMod (1)YesNo

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)

  • Answer 1: The status of the cache block becomes Modified Right: after any write the line is dirty, so E becomes M.
  • Answer 2: The cache block is retrieved from memory It is a hit: the block is already in the cache, and clean.
  • Answer 3: The cache block is retrieved from another cache No other cache holds it — that is what Exclusive means.
  • Answer 4: An invalidate is broadcasted on the bus to the other copies of the block There are no other copies: E → M is silent, and that is the whole point of the E state.
  • Answer 5: The cache block is overwritten in the processor's cache Right: with write-back the write updates the local copy only.
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 2) How does a MESI write-invalidate write-back protocol manage a Write Hit on a cache block which is Shared in another cache? (MULTIPLE ANSWERS)

  • Answer 1: The status of the cache block becomes Modified Right: the writer ends with the only, dirty copy.
  • Answer 2: The cache block is retrieved from memory It is a hit: the data is already in the writer's cache.
  • Answer 3: The cache block is retrieved from another cache Same reason: nothing has to be fetched on a hit, only permission is missing.
  • Answer 4: An invalidate is broadcasted on the bus to the other copies of the block Right: the other Shared copies must become Invalid before the write.
  • Answer 5: The cache block is overwritten in the processor's cache Right: the write goes into the local copy (write-back).
Show model answer

Answers 1, 4 and 5. The block is present but not exclusive: the cache broadcasts an invalidate on the bus, the other copies become Invalid, the block is written in the local cache and its state becomes Modified. No data is transferred, because the writer already has the block.

Questions 1 and 2 of the paper differ in one answer, the invalidate. Answers 2 and 3 are the distractors for both: they belong to a miss, not to a hit.

(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.

CycleAfter OperationP0 cache block stateP1 cache block stateP2 cache block stateP3 cache block stateMemory at bl. 0 up to date?Memory at bl. 1 up to date?
0P0: write Bl. 1Mod (1)InvalidInvalidInvalidYesNo
1P1: Write Bl. 0Mod (1)Mod (0)InvalidInvalidNoNo
2P2: Write Bl. 1InvalidMod (0)Mod (1)InvalidNoNo
3P3: Read Bl. 0InvalidShared (0)Mod (1)Shared (0)YesNo
4P0: Read Bl. 1Shared (1)Shared (0)Shared (1)Shared (0)YesYes
5P2: Write Bl. 0Shared (1)Shared (0)Mod (0)Shared (0)NoYes

Which is the wrong line? (SINGLE ANSWER) Motivate your answer.

  • Answer 1: Line 1 Correct as printed: P1's write miss finds no other copy of block 0 and takes Mod (0); P0's Mod (1) is another block. Memory: No, No.
  • Answer 2: Line 2 Correct as printed: P0 writes block 1 back and is invalidated, P2 takes Mod (1), and memory at bl. 1 is No again because P2 writes.
  • Answer 3: Line 3 Correct as printed: P1 writes block 0 back on P3's Read Miss and both end Shared (0); memory at bl. 0 is Yes.
  • Answer 4: Line 4 Correct as printed: P2 writes block 1 back on P0's Read Miss, both end Shared (1), memory at bl. 1 is Yes.
  • Answer 5: Line 5 Wrong line: P2's write miss on block 0 must invalidate the Shared (0) copies of P1 and P3.
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:

CycleAfter OperationP0 cache block stateP1 cache block stateP2 cache block stateP3 cache block stateMemory at bl. 0 up to date?Memory at bl. 1 up to date?
5P2: Write Bl. 0Shared (1)InvalidMod (0)InvalidNoYes

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 Shared, P1 Shared, memory for X up to date P0 snoops the Read Miss and pulls the shared line, so P1 takes S and P0 drops from E to S. E is clean: memory stays up to date.
  • P0 writes X back, then both are Shared Only a Modified line is written back. An Excl copy matches memory, so there is nothing to write.
  • P0 stays Excl, P1 Shared Excl means "the only copy"; once P1 holds X, that is no longer true, so P0 must drop to S.
  • P0 Invalid, P1 Excl A read never invalidates other copies — only a write does.

P0 and P1 hold block X Shared. P0 replaces X with another block. Then P1 writes X. What does P1 put on the bus?

  • Nothing: P1 is now the only holder It is the only holder, but it does not know it: P0's clean replacement was silent.
  • An Invalidate A write hit in Shared always invalidates, because a Shared line cannot know that the other copies are gone. This is the price of silent replacements.
  • A Write Miss P1 still holds X, so this is a hit; a Write Miss would fetch the block again.
  • A write-back of X X is clean in P1's cache: there is nothing to write back.

Which events make a MESI cache write a block back to memory? Select all that apply.

  • Replacing a Modified line Yes: the only up-to-date copy is about to leave the cache.
  • Snooping a Read Miss for a line it holds Modified Yes: the owner writes back and both end Shared, so memory is up to date again.
  • Snooping a Write Miss for a line it holds Modified Yes: the owner writes back before invalidating its copy.
  • Replacing an Exclusive line No: an Excl line matches memory, so it leaves silently.
  • A write hit on an Exclusive line No: the write stays in the cache (write-back) and the line becomes Mod.
  • Snooping a Read Miss for a line it holds Exclusive No: the line drops to Shared, but it is clean — nothing to write.

All write-backs come from M: replacement, snooped Read Miss, snooped Write Miss.

What does MESI need in hardware that MSI does not?

  • A shared line on the bus, pulled during a read miss by every cache that holds the block Without it the requester cannot choose between E and S.
  • One more state bit in every cache line MSI's three states already need two bits, and four states still fit in two.
  • A directory next to memory A directory replaces broadcast in large machines; MESI is a snooping protocol.
  • Write-through caches The opposite: MESI only makes sense with write-back caches, which can hold dirty lines.

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?

  • No P0 writes block 0 back, so memory is fresh for an instant — then P1's write makes P1's copy Mod and memory stale again.
  • Yes, because P0 wrote the block back The write-back happens, but P1 writes right after it: the column shows the state after the whole row.
  • Yes, because P0 is now Invalid What matters is whether any cache holds the block in Mod — and P1 does.

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?

  • 20 with MSI, 10 with MESI MSI: a Read Miss and an Invalidate per block. MESI: the Read Miss lands in E and the write is silent.
  • 10 and 10 Under MSI the block arrives in S, so the first write of each block needs an Invalidate.
  • 20 and 20 Under MESI nobody pulls the shared line, the block arrives in E and the write is silent.
  • 10 and 0 The first read of each block is a miss under any protocol: the data has to come over the bus.

Key take-aways

What to watch and read