Sponsored Links
-->

Senin, 07 Mei 2018

Vintage Old Clock Vector
src: static.vecteezy.com

A vector clock is an algorithm for generating a partial ordering of events in a distributed system and detecting causality violations. Just as in Lamport timestamps, interprocess messages contain the state of the sending process's logical clock. A vector clock of a system of N processes is an array/vector of N logical clocks, one clock per process; a local "smallest possible values" copy of the global clock-array is kept in each process, with the following rules for clock updates:

  • Initially all clocks are zero.
  • Each time a process experiences an internal event, it increments its own logical clock in the vector by one.
  • Each time a process sends a message, it increments its own logical clock in the vector by one (as in the bullet above) and then sends a copy of its own vector.
  • Each time a process receives a message, it increments its own logical clock in the vector by one and updates each element in its vector by taking the maximum of the value in its own vector clock and the value in the vector in the received message (for every element).

The vector clocks algorithm was independently developed by Colin Fidge and Friedemann Mattern in 1988.


Video Vector clock



Partial ordering property

Vector clocks allow for the partial causal ordering of events. Defining the following:

  • V C ( x ) {\displaystyle VC(x)} denotes the vector clock of event x {\displaystyle x} , and V C ( x ) z {\displaystyle VC(x)_{z}} denotes the component of that clock for process z {\displaystyle z} .
  • V C ( x ) < V C ( y ) ? ? z [ V C ( x ) z <= V C ( y ) z ] ? ? z ? [ V C ( x ) z ? < V C ( y ) z ? ] {\displaystyle VC(x)<VC(y)\iff \forall z[VC(x)_{z}\leq VC(y)_{z}]\land \exists z'[VC(x)_{z'}<VC(y)_{z'}]}
    • In English: V C ( x ) {\displaystyle VC(x)} is less than V C ( y ) {\displaystyle VC(y)} , if and only if V C ( x ) z {\displaystyle VC(x)_{z}} is less than or equal to V C ( y ) z {\displaystyle VC(y)_{z}} for all process indices z {\displaystyle z} , and at least one of those relationships is strictly smaller (that is, V C ( x ) z ? < V C ( y ) z ? {\displaystyle VC(x)_{z'}<VC(y)_{z'}} ).
  • x -> y {\displaystyle x\to y\;} denotes that event x {\displaystyle x} happened before event y {\displaystyle y} . It is defined as: if x -> y {\displaystyle x\to y\;} , then V C ( x ) < V C ( y ) {\displaystyle VC(x)<VC(y)}

Properties:

  • If V C ( a ) < V C ( b ) {\displaystyle VC(a)<VC(b)} , then a -> b {\displaystyle a\to b\;}
  • Antisymmetry: if V C ( a ) < V C ( b ) {\displaystyle VC(a)<VC(b)} , then ¬ ( V C ( b ) < V C ( a ) ) {\displaystyle (VC(b)<VC(a))}
  • Transitivity: if V C ( a ) < V C ( b ) {\displaystyle VC(a)<VC(b)} and V C ( b ) < V C ( c ) {\displaystyle VC(b)<VC(c)} , then V C ( a ) < V C ( c ) {\displaystyle VC(a)<VC(c)} or if a -> b {\displaystyle a\to b\;} and b -> c {\displaystyle b\to c\;} , then a -> c {\displaystyle a\to c\;}

Relation with other orders:

  • Let R T ( x ) {\displaystyle RT(x)} be the real time when event x {\displaystyle x} occurs. If V C ( a ) < V C ( b ) {\displaystyle VC(a)<VC(b)} , then R T ( a ) < R T ( b ) {\displaystyle RT(a)<RT(b)}
  • Let C ( x ) {\displaystyle C(x)} be the Lamport timestamp of event x {\displaystyle x} . If V C ( a ) < V C ( b ) {\displaystyle VC(a)<VC(b)} , then C ( a ) < C ( b ) {\displaystyle C(a)<C(b)}

Maps Vector clock



Other mechanisms

  • Almeida et al., introduced in 2008 Interval Tree Clocks. This mechanism generalizes Vector Clocks and allows operation in dynamic environments when the identities and number of processes in the computation is not known in advance. You can find an implementation of ITC named itc4j here.
  • Torres-Rojas and Ahamad, developed in 1999 Plausible Clocks, a mechanism that takes less space than vector clocks but that, in some cases, will totally order events that are causally concurrent.

Clock Vector Icon. Illustration Style Is Flat Iconic Black Symbol ...
src: previews.123rf.com


See also

  • Lamport timestamps
  • Matrix clocks
  • Version vector

Vector Clock Face And Hands Royalty Free Cliparts, Vectors, And ...
src: previews.123rf.com


References


Vector Clock Face - Easy Change Time Royalty Free Cliparts ...
src: previews.123rf.com


External links

  • Why Logical Clocks are Easy (Compares Causal Histories, Vector Clocks and Version Vectors)
  • Explanation of Vector clocks
  • Timestamp-based vector clock implementation in Erlang
  • Vector clock implementation in Objective-C
  • Vector clock implementation in Erlang
  • Why Vector Clocks are Hard
  • Riak Vector Clocks
  • Why Cassandra doesn't need vector clocks

Source of article : Wikipedia