Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Sequential Consistency and Eventual Consistency?

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?

like image 717
Sergey Avatar asked Sep 25 '17 07:09

Sergey


People also ask

What is the difference between eventual consistency vs strong consistency?

Strong Consistency offers up-to-date data but at the cost of high latency. While Eventual consistency offers low latency but may reply to read requests with stale data since all nodes of the database may not have the updated data.

How causal consistency is different from sequential consistency?

a) Sequential Consistency → Causal Consistency In sequential consistency, all writes must be seen in the same order by all processes. In causal consistency, causally related writes must be seen in the same order.

What is meant by sequential consistency?

Sequential consistency is a strong safety property for concurrent systems. Informally, sequential consistency implies that operations appear to take place in some total order, and that that order is consistent with the order of operations on each individual process.


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.

like image 189
rystsov Avatar answered Oct 20 '22 01:10

rystsov