logical scalar clock для causality + LWW conflict resolution
Lamport clocks assign integers to events so that causal order is respected without requiring synchronized wall clocks.
The relation a -> b holds when:
Concurrent events have neither a -> b nor b -> a.
Each process stores a local counter C.
The clock condition is one-way:
a -> b implies L(a) < L(b)
The converse is false. L(a) < L(b) does not prove that a caused b. Equal values on different processes may also be concurrent.
Sorting by (L(event), processId) creates a deterministic total order. The process-ID tie-break is arbitrary for concurrent events. It can support deterministic replay or queue ordering, but it does not establish real-time precedence and it is not a consensus protocol.
Vector clocks retain enough per-participant information to detect concurrency, at metadata cost proportional to the tracked participant set. They still need a separate conflict policy.
An HLC combines a physical-time component with a logical counter. It can stay close to wall time while preserving causal monotonicity, subject to the implementation's clock assumptions. It is not proof of perfectly synchronized global time.
Persist a stable node/process identity and the last emitted clock across restart when monotonicity across restart is required. Detect counter overflow and corrupted future timestamps.
The animation covers send/receive updates, the one-way clock condition, concurrent events, deterministic tie-breaking, and the HLC boundary.
Введите числа или выберите пресет