Johannes Karl Arnold

Logical Time


Lamport Timestamps

Propose we have two events, (A) and (B). Lamport timestamps allow for a “happens before” relationship, (A \to B.)

Each node (p) maintains a counter (LT(p)), which gets incremented when (p) performs an action. When (p) sends a message, it includes (LT(p)). A recieving node (q) then updates its own counter to (\max{LT(p),~LT(q)})

…Kind of like TCP’s seqno to track packet orders?

If (A \to B), then (LT(a) < LT(b)):

This is the main drawback of lamport clocks.

Vector Clocks

On a system of (n) nodes, each node (i) maintains a vector (V) of length (n).

Initially, all clocks are zero, with (V_i) being the number of events that occured at node (i) and (V_i[j]) being the number of events observed by node (i) that occurred at node (j).

Vector clocks address the issues of Lamport Timestamps: