Time and ordering
Time and ordering is the problem of deciding which event came first when events happen on different machines. Wall clocks can’t settle it, because every machine’s clock drifts and can be off by milliseconds or more. Instead you track causality: event A “happened before” B if A could have influenced B, because the same machine did A first or a message carried news of A. A Lamport clock is a counter each machine bumps on every event and attaches to its messages; a receiver jumps to the larger of its own and the received value, plus one. It guarantees that if A happened before B, A gets the smaller number, though a smaller number alone doesn’t prove A came first. A vector clock keeps one counter per machine, which also tells you when two events were concurrent, meaning neither could have known about the other. That’s how systems spot conflicting writes.