Linearizablity at a Single Site
Note that:
In (1)(2)(3) get()s and inc()s appear to be executed in sequential order
-------- (Edited on Mar. 15th, 2020)
More precise definition of linearizability:
1. all operations appear to be executed in sequential order, i.e. there exists a total order of all operations
2. the order matches real-time
3. reads see preceding writes in the order
According to this definition, history of get()s and inc()s in (1) is also linearizable
Another imprecise statement above is that "get()s and set()s in (1) are executed sequentially". A more precise description would be "critical sections of get()s and set()s in (1) are executed sequentially"
Linearizablity of Distributed Systems
Linearizability forbids:
1. split brain
2. forgetting commited writes after reboot
3. read from lagging replicas
4. nonmonotonic reads
...
Linearizability v.s. Serializability
Linearizability is a guarantee about single operations on single objects, It provides a real-time guarantee on the behavior of a set of single operations (often reads and writes) on a single object (e.g., distributed register or data item).
Serializability is a guarantee about transactions, or groups of one or more operations over one or more objects. It guarantees that the execution of a set of transactions (usually containing read and write operations) over multiple items is equivalent to some serial execution (total ordering) of the transactions. Unlike linearizability, serializability does not—by itself—impose any real-time constraints on the ordering of transactions. Serializability does not imply any kind of deterministic order—it simply requires that some equivalent serial execution exists.
Strict serializability, transaction behavior is equivalent to some serial execution, and the serial order corresponds to real time.
For example, say I begin and commit transaction T1, which writes to item x, and you later begin and commit transaction T2, which reads from x. A database providing strict serializability for these transactions will place T1 before T2 in the serial ordering, and T2 will read T1’s write. A database providing serializability (but not strict serializability) could order T2 before T1.
Linearizability can be viewed as a special case of strict serializability where transactions are restricted to consist of a single operation applied to a single object.
References
Wikipedia Page for Linearizability: https://en.wikipedia.org/wiki/Linearizability
Peter Bailis's Blog: Linearizability versus Serializability
JEPSEN Consistency Models: https://jepsen.io/consistency
JEPSEN Linearizability: https://jepsen.io/consistency/models/linearizable
Kyle Kingsbury's Blog: Serializability, Linearizability, and Locality
Peter Bailis's Paper: Highly Available Transactions: Virtues and Limitations