We have a set of n sequential processes $p_{1},...,p_n$ , that access $m$ concurrent objects $X_1,...,X_m$ by invoking operations on the form `Xi.op(args)(ret)`. When invoked by $p_j$, the invocation `Xi.op(args)(ret)` is modeled by two events: `inv[Xi.op(args) by pj]` and `res[Xi.op(ret) to pj]`. A **history** (or **trace**) is a pair $\hat{H}=(H, <_{H})$ where $H$ is a set of events and $<_{H}$ is a total order on them. The *semantics* (of systems and/or objects) will be given as the set of traces. A history is **sequential** if it is of the form `inv res inv res ... inv res inv inv inv ...`, where every res is the result of the immediately preceding inv. (The last invocations do not have a return). A sequential history can be represented as a sequence of operations. A history is **complete** if every inv is eventually followed by a corresponding res, it is **partial** otherwise. ### Linearizability A complete history $\hat{H}$ is **linearizable** if there exists a sequential history $\hat{S}$ s.t. - $\forall X :\hat{S}|_{X} \in semantics(X)$ - $\forall p:\hat{H}|_{p} = \hat{S}|_p$ - cannot swap actions performed by the same process - If $res[op] <_{H} inv[op']$, then $res[op] <_{S} inv[op']$ - can rearrange events only if they overlap Given an history $\hat{K}$, we can define a binary relation on events $⟶_{K}$ s.t. (op, op’) ∈ ⟶K if and only if res[op] x op'), this implies $res(op') <_X inv(op)$, which means that $op' \to_X op$, and so it won't be a total order... So this is not possible either. 3. It cannot have cycles with more than 2 edges: - by contradiction, consider a shortest cycle - adjacent edges cannot belong to the same order (e.g. not both $\to_X$), otw. the cycle would be shortable, because of transitivity of the total order! - adjacent edges cannot belong to orders on different objects - this would mean that an operation is involved in both $\to_X$ and $\to_Y$ but it is not possible of course, so the cycle can only happen edges in $\to_X$ and $\to_H$. - Hence, at least one $\to_X$ exists and it must be between two $\to_H$ i.e.: $$op1 \to_H op2 \to_X op3 \to_H op4$$, likely with op1 = op4 - can this be a cycle? - $op1 \to_H op2$ means that $res(op1) <_H inv(op2)$ - $op2 \to_X op3$ entails that $inv(op2) <_H res(op3)$ - if not, as is a total order, we would have that $res(op3) <_H inv(op2)$, but we then would have $op3 \to_H op2$, forming a cycle of lenght 2 because $op2 \to_X op3$, and we know cycles of lenght 2 are not possible... - $op3 \to_H op4$ means that $res(op3) <_H inv(op4)$ - We would then have that $res(op1) <_H inv(op2) <_H res(op3) <_H inv(op4)$ - So by transitivity $res(op1) <_H inv(op4)$, i.e. $op1 \to_H op4$ - IN CONTRADICTION WITH HAVING CHOSEN A SHORTEST CYCLE - as if op4 = op1, then this could not happen as $\to$ is a total order. This said, we can say that **every DAG admits a topological order** (a total order of its nodes that respects the edges), we will call $\to'$ the topological order for $\to$ Let us define a linearization of $\hat{H}$ as follows: $$\hat{S}=inv(op1)res(op1)inv(op2)res(op2)...$$ we would have the topological order: $op1\to'op2\to'...$ $\to'_X$ $\to|_X$ $\to_X$ Si ha che $\to|_X \space \subseteq \space \to'_X$ perché l'ordinamento topologico è letteralmente la sequenza di eventi in $\hat{S}$ $\hat{S}$ is clearly sequential. Moreover: 1. $\forall X :\hat{S}|_{X} = \hat{S}_X (\in semantics(X))$, indeed: - $<_{\hat{S}_X} \space = \space\to_X\space \subseteq\space \space\to|_X\space \subseteq\space \to'_X\space = \space\to_{\hat{S}|X}\space=\space<_{\hat{S}|X}$ - commento per non diventare scemi: - $\hat{S}_X$ lo storico ottenuto linearizzando $\hat{H}|_X$ - definisce una relazione di ordinamento $\to_X$ - $\hat{S}|_X$ lo storico che ottengo filtrando per le operazioni su X, partendo da $\hat{S}$, che a sua volta viene ottenuto linearizzando $\hat{H}$ - definisce una relazione di ordinamento $\to|_X$ - naturlamente, possiamo considerare $\to_X \space = \space <_{\hat{S}_X}$ e $\to|_X \space = \space <_{\hat{S}|_X}$ (se l'ordinamento è uguale, allora anche le coppie in relazione tra loro sono le stesse) > [!PDF|red] class 6, p.6> we would have a cycle of length > > we would contraddict op2 ->x op3 ... ...