2.8.3. Vector Clock

Vector clock timestamp is a vector of integer numbers maintained at each process in a group of communicating processes. The size of the vector is equal to the number of processes in the group. The timestamp is updated using three rules:

Again, the update rules are based on the definition of the causal relation. Intuitively, the element i of the timestamp of process j corresponds to the latest event at process i that process j can know of.

Timestamps can be compared to each other. Timestamp A is smaller (or larger) than timestamp B if each element of A is numerically not larger (or not smaller) than the corresponding element of B, and at least one element of A is numerically smaller (or larger) than the corresponding element of B. Timestamp A is unrelated to timestamp B if it is neither smaller nor larger.

If and only if an event A causally precedes an event B, the vector clock timestamp associated with the event A is smaller than the vector clock timestamp associated with the event B. If and only if an event A is causally unrelated to an event B, the vector clock timestamp associated with the event A is unrelated to the vector clock timestamp associated with the event B.

When used to enforce ordering guarantees on messages exchanged in a group of communicating processes, the only significant event is sending of a message. Then, the element i of the timestamp of process j corresponds to the number of messages sent by process i that process j has received. The node hosting a process can deliver a received message to the process when at most one of the elements of the message timestamp is larger than the corresponding element of the process timestamp, and larger exactly by one.