- Vector clock
Vector Clocks is an
algorithm for generating apartial ordering of events in adistributed system and detectingcausality violations. Just as inLamport timestamps , interprocess messages contain the state of the sending process'slogical clock . Vector clock of a system of "N" processes is an array of "N" logical clocks, one per process, a local copy of which 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 ownlogical clock in the vector by one.
* Each time a process prepares to send a message, it increments its ownlogical clock in the vector by one and then sends its entire vector along with the message being sent.
* Each time a process receives a message, it increments its ownlogical 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 developed by
Friedemann Mattern in1988 . [Citation
last1=Mattern | first1=F.
contribution=Virtual Time and Global States of Distributed Systems
editor-last=Cosnard | editor-first=M. | title=Proc. Workshop on Parallel and Distributed Algorithms
place=Chateau de Bonas, France
date=Oct. 1988
publisher=Elsevier
year=1989
pages=215-226 ]Partial ordering property
Vector clocks allow for the partial causal ordering of events. Defining the following:
* VC(x) denote the vector clock of event x
*
** In English: VC(x) is less than VC(y) if and only if VC(x) [z] is less than or equal to VC(y) [z] for all indices z and there exists an index z' such that VC(x) [z'] is strictly less than VC(y) [z'] .
* x -> y denote event x happened before event y. It's defined as: if x -> y, then VC(x) < VC(y)Properties:
* If VC(a) < VC(b), then a -> b
* Antisymmetry: if VC(a) < VC(b), then ¬ VC(b) < VC(a)
* Transitivity: if VC(a) < VC(b) and VC(b) < VC(c), then VC(a) < VC(c) or if a -> b and b -> c, then a -> cee also
*
Lamport timestamps References
Wikimedia Foundation. 2010.