Loading
0x20Lesson 3 of 9

Reason about time and ordering

Distinguish wall-clock timestamps from causal order.

14 min 5-question quiz
By the end of this lesson you can
  • Explain clock skew, logical ordering, and why timestamps alone do not prove causality.

Machines keep separate clocks, and those clocks drift or jump. Two events with close wall-clock timestamps may not have a reliable order. Lamport clocks provide a logical ordering rule: increment a local counter for each event, and when receiving a message set the counter to one more than the maximum of the local value and the received value. This preserves causal order, but does not measure elapsed time.

Python simulation · illustrative only
1local = 4
2received = 9
3local = max(local, received) + 1
4print(local)
Output
10

A Lamport timestamp can say that one event is ordered before another in the logical clock scheme. If you need to know whether two events are concurrent, a vector clock carries more information. Neither clock replaces synchronized time for deadlines.

Key takeaways

  • Physical clocks can disagree.

  • Logical clocks track ordering, not elapsed duration.

  • Use monotonic time for local deadlines and timeouts.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Did you like the lesson? 😆👍
Consider a donation to support our work: