Does sequential consistency implies cache coherence?

Viewed 78

The definition of cache coherence says that:

  1. A read must return the most recent write.
  2. Every write must eventually be accessible via a read.
  3. Writes to a given location are seen in the same order by all processors

In sequential consistency

  1. There is a total order for all operations
  2. Every operation is atomic.
  3. The total order should follow the program order.

If we conform to the sequential consistency, every condition of cache coherence seems to be fulfilled. So I guess the sequential consistency implies cache coherence (and sequential consistency is stronger than cache coherence).

2 Answers

Yes. Coherence can be seen as sequential consistency per location.

So for sequential consistency: if the results of the execution can be explained by a different execution with the following properties:

  1. there should be a total order of the loads/stores over all locations.

  2. this order is consistent with the program order of each of the cores.

  3. a read should see the most recent write before it in this order.

then the execution is sequentially consistent.

For coherence, you only need a total order per location, but otherwise, the same rules apply as with sequential consistency.

So any execution that is sequentially consistent, is coherent. But the converse doesn't need to be true.

The key in a sequential consistency is that all processors will see all events in the same order, but there is no guarantee when that will happen. As a result, in many cases you won't be able to get most recent write.

In a strongly consistent system, both order and recency are met.

Btw, I saw in some literature a weaker definition of sequential consistency - all processors will see events in SOME order, but the order is the same for all. What it means, that if you have several writes, they might be executed in whatever order - maybe not in the order a client submits them; but all processors will get the same order, whatever the order is.

Related