What is the difference between Sequential Consistency and Eventual Consistency?

Viewed 2038

There are two definitions I found on the Internet:

Sequential consistency -- the result of any execution is the same as if the operations of all the processors were executed in some sequential order, and the operations of each individual processor appear in this sequence in the order specified by its program.

Eventual Consistency -- if no new updates are made to a given data item, eventually all accesses to that item will return the last updated value.

The definitions are clear to me. However, I don't get when eventual consistency is not sequential. An example: Initial val in mem is 0. Horizontal axis is the time.

P1:      write 1             (x)
P2:  read 0    read 0 read 0     read 1   read 1    read 1

So, there is some sequential order, the one if we put "write 1" in (x) slot, and this is sequential consistency by definition. Where am I wrong?

1 Answers

The difference between sequential consistency and eventual consistency is in the guarantees they provide.

Eventual consistency doesn't specify:

  • What happens if there are concurrent updates to a register
  • How long the period of inconsistencies lasts

As a result, even a single client may run into a situation when she modifies a register but a follow up read returns stale data.

The same case is impossible with sequential consistency by definition (the overall order respects the sub-processors order).

Moreover, if a program doesn't make time-sensitive assumptions and all the clients (processors) don't communicate outside of the system then sequential consistency is indistinguishable from linearizability. On the contrary, eventual consistency is much closer to the lack of consistency rather than to linearizability.

Related