Multicore & Synchronization
In an invalidation-based coherence protocol, what happens when a core writes to a line in the Shared (S) state?
- AIt leaves other copies alone and updates only its own line
- BIt invalidates other cores' copies of the line, then sets its own line to M and writes
- 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.
- 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.