Multicore & Synchronization

What is the difference between cache coherence and a memory consistency model?

  1. AThey mean the same thing under different names
  2. BCoherence keeps values at the same address consistent; a consistency model governs the order in which operations on different addresses appear
  3. CCoherence is purely software, and consistency purely hardware
Show answer and explanation

Answer: B. Coherence keeps values at the same address consistent; a consistency model governs the order in which operations on different addresses appear

Coherence guarantees, for any single address, that all cores see its writes in the same order and eventually read the latest value. A consistency model specifies, when core 0 writes x and then y, in what orders other cores may observe those writes. Even with coherence, writes to different addresses can appear reordered, which is where barriers are needed.

  • A. They address different problems.
  • B. Correct. Both are needed to write correct parallel programs.
  • C. Both involve hardware and software.
Practice this topic Back to topic

More Multicore & Synchronization questions

  1. Which describes the idea of hardware transactional memory?
  2. When waiting on a condition variable until a queue becomes non-empty, why is the condition rechecked in a while loop rather than an if after waking?
  3. Two cores each hold a copy of variable x in their own caches. After core 0 writes x, what problem could occur when core 1 reads x if there were no cache coherence mechanism?
  4. Which correctly lists the four states of the MESI cache coherence protocol?
  5. In the MESI protocol, what does it mean when a cache line is in the Modified (M) state?