Linearizability and Sequential Consistency
a) | A sequentially consistent data store. |
b) | A data store that is not sequentially consistent. |
Sequential Consistency
A data store is sequentially consistentwhen the result of any execution is the same as if the (read and write)operations by all processes on the data store were executed in some sequentialorder and the operations of each individual process appear in this sequence inthe order specified by its program.
Translation into English: any valid interleaving of read and writeoperations is OK, butall processes must see the same interleaving. Inother words,theevents observed by each process must globally occur in the same order, or it isnot sequentially consistent.It doesn't actually matter if the eventsdon't really agree with clock time, as long as they are consistent.
Important facts:
- Time doesn't matter as much. That is, absolute time is somewhat irrelevant. The order of events is most important.
- A process only observes writes made by other processes. Reads by other processes are completely irrelevant to it.
Audio link: Why is (a) consistent and (b) not?
Linearizable
The linearizable consistency model handles the apparent incongruityabove. Specifically, itlooks like the write of the value a to xoccurred before the write of the value b. Thus, (intuitively) you might thinkthat, accounting for propagation delays, etc., processes 3 and 4 should firstread a value of a, then later read a value of b (either that or, you'd intuit thatthe value b is always read, and the value a isnever read, which wouldbe true in certain circumstances). The linearizable consistency model ensuresthis by adding a timestamp ts_{op}(x) (sorry about the text formatting but htmljust doesn't do it yet). This timestamp is simply the global time (in a loosesense) assigned to an operation OP.It is the same definition as sequential consistency withthe additional constraint that if the timestamp of x is less than the timestampof y then x must occur before y in the sequence.
Since it's the same definition withadditional constraints, it implies that a linearizable data store is alsosequentially consistent (but not the other way around, of course).
原文地址:http://regal.csep.umflint.edu/~swturner/Classes/csc577/Online/Chapter06/img06.html
附加内容:
Summary of Consistency Models
![](http://regal.csep.umflint.edu/%7Eswturner/Classes/csc577/Online/Chapter06/Images/06-18.jpg)
a) | Consistency models not using synchronization operations. |
---|---|
b) | Models with synchronization operations. |