Vector clocks
Encyclopedia
Vector clocks are an algorithm
Algorithm
In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning...

 for generating a partial ordering of events in a distributed system and detecting causality
Causality
Causality is the relationship between an event and a second event , where the second event is understood as a consequence of the first....

 violations. Just as in Lamport timestamps
Lamport timestamps
The algorithm of Lamport timestamps is a simple algorithm used to determine the order of events in a distributed computer system. As different nodes or processes will typically not be perfectly synchronized, this algorithm is used to provide a partial ordering of events with minimal overhead, and...

, interprocess messages contain the state of the sending process's logical clock
Logical clock
A logical clock is a mechanism for capturing chronological and causal relationships in a distributed system.Logical clock algorithms of note are:* Lamport timestamps, which are monotonically increasing software counters....

. 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
    Logical clock
    A logical clock is a mechanism for capturing chronological and causal relationships in a distributed system.Logical clock algorithms of note are:* Lamport timestamps, which are monotonically increasing software counters....

     in the vector by one.
  • Each time a process prepares to send a message, it increments its own logical clock
    Logical clock
    A logical clock is a mechanism for capturing chronological and causal relationships in a distributed system.Logical clock algorithms of note are:* Lamport timestamps, which are monotonically increasing software counters....

     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 own logical clock
    Logical clock
    A logical clock is a mechanism for capturing chronological and causal relationships in a distributed system.Logical clock algorithms of note are:* Lamport timestamps, which are monotonically increasing software counters....

     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
Friedemann Mattern
Friedemann Mattern is a German scientist.After studying computer science with a minor in communication sciences at the University of Bonn, Mattern became a VLSI design and parallelism researcher at Kaiserslautern University of Technology.He got his doctorate degree in 1989 after writing a...

 in 1988.

Partial ordering property

Vector clocks allow for the partial causal ordering of events. Defining the following:
  • denote the vector clock of event , and denote the component of that clock for process .
    • In English: is less than , if and only if is less than or equal to for all process indices , and at least one of those relationships is strictly smaller (that is, ).
  • denote event happened before event . It's defined as: if , then


Properties:
  • If , then
  • Antisymmetry
    Antisymmetric relation
    In mathematics, a binary relation R on a set X is antisymmetric if, for all a and b in Xor, equivalently,In mathematical notation, this is:\forall a, b \in X,\ R \and R \; \Rightarrow \; a = bor, equivalently,...

    : if , then ¬
  • Transitivity
    Transitive relation
    In mathematics, a binary relation R over a set X is transitive if whenever an element a is related to an element b, and b is in turn related to an element c, then a is also related to c....

    : if and , then or if and , then


Relation with other orders:
  • Let be the real time when event occurs. If , then
  • Let be the Lamport timestamp
    Lamport timestamps
    The algorithm of Lamport timestamps is a simple algorithm used to determine the order of events in a distributed computer system. As different nodes or processes will typically not be perfectly synchronized, this algorithm is used to provide a partial ordering of events with minimal overhead, and...

    of event . If , then

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.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK