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.

  • 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.
Practice this topic Back to topic

More Multicore & Synchronization questions

  1. In MESI, when core 1 tries to read a line that core 0 holds in the Modified (M) state, what generally happens?
  2. Which describes the snooping approach to cache coherence?
  3. Why do systems with many cores use directory-based coherence instead of snooping?
  4. Coherence protocols can be invalidation-based or update-based. Why do most CPUs use invalidation?
  5. Which describes false sharing in a multithreaded program?