Consistency: Specifies what behaviour is allowed when a shared object is accessed by multiple procs.
Shared object: Abstract Data Type that supports access from multiple processes.
Mutual exclusion is actually a way to ensure consistency by preventing unwanted behaviour
Lamport’s informal definition: The results are the same as if all operations by multiple processors were executed in some sequential order specified by the program (i.e. executed by a single processor with no interleaving operations.)
Operation: An invocation/response pair of a single shared object by a process
History $H$: sequence of inv/res totally ordered by wall clock time
Sequential history:
How to tell if a history is sequential:
Legal sequential history:
Subhistory: The subsequence of all events of either process $p$ or object $o$.
Equivalency: Two histories equivalent if they have the same set of events, implying all responses’ values are the same (though event ordering may be different).
History $H$ is sequentially consistent if
Linearizability: Induces $<_H$ partial order. $o_1 <_H o_2$ if $resp(o_1) < resp(o_2)$ in $H$ (occured-before order).
This order is known as external order.
Linearizable history $H$:
Linearizability is a local property.
$H$ is linearizable if and only if $H \mid x$ is linearizable (for any object $x$).
Sequential consistency is not a local property. See slides for example.
$H$ is linearizable if and only if $H \mid x$ is linearizable (for any object $x$).
Only if (trivial): if $H$ is linearizable, then it is equivalent to some legal sequential history $S$ that adheres to external order from $H$. The subhistory $S \mid x$ must also still be a legal sequential history that adheres to external order from $H$ which includes $H \mid x$. This shows that $H \mid x$ is linearizable
If (nontrivial): Suppose $H \mid x$ is linearizable for any object $x$.
We define a digraph $G$ such that each op is a node in $G$, and each pair of nodes $a,b$ has an edge $a \rightarrow b$
Lemma: The digraph $G$ will always be a DAG.
Proof: Suppose for contradiction that a cycle may exist. Such a cycle must be of the form $A \rightarrow B \rightarrow C \rightarrow D \rightarrow A$
Since $H$ has an external order imposed by wall clock time and $H \mid y$ also preserves external order, then $B < C < D < A$. However since $H \mid x$ also preserves external order we need $A < B$ to hold as well. Hence we have a contradiction.
Proof of local property: By lemma, we know that we can always achieve a topological ordering of the operations in the history $H$ across all the objs. Hence this ordering $S$ is a sequential history that adheres to the external order.
But is $S$ legal?
Def 1 $\Rightarrow$ Def 2.
Def 2 $\Rightarrow$ Def 1.
Let the legal sequential history $S$ be $a, b, c \dots$.