Multicore & Synchronization

In an invalidation-based coherence protocol, what happens when a core writes to a line in the Shared (S) state?

  1. AIt leaves other copies alone and updates only its own line
  2. BIt invalidates other cores' copies of the line, then sets its own line to M and writes
  3. CIt empties every core's cache before writing
Show answer and explanation

Answer: B. It invalidates other cores' copies of the line, then sets its own line to M and writes

In S, other cores may hold the same line, so writing directly would leave their copies stale. The core sends an invalidation request, putting other copies into I, then sets its own line to M and writes. When another core next reads the data it misses and fetches the latest value. Most CPUs use this invalidation-based approach.

MESI protocol state transitions Local write Remote write Remote write Local read (others have it) Remote write Local read (no others) Local write (invalidate others) Remote read (write back) Local write (no bus msg) Remote read M I S E Local core read/write Snooped read/write by others M: Modified, only here E: Clean, only here S: Clean, shared I: Invalid
MESI protocol state transitions · View in diagrams
  • A. Other cores would then read stale values.
  • B. Correct. It ensures no stale copies remain.
  • C. There is no need to clear unrelated lines.