AlgoMaster Logo

Lamport Timestamps

Low Priority21 min readUpdated July 4, 2026
AI Mock Interview

Practice this topic in a realistic system design interview

Ordering events across machines is harder than it looks. Each machine has its own clock, and those clocks never agree perfectly. Lamport timestamps avoid that problem by not using physical time at all.

Instead, each process keeps a simple integer counter. The counter goes up when the process does something, sends a message, or receives a message.

The key promise is small but useful:

If event A could have caused event B, then A gets a smaller Lamport timestamp than B.

Written shortly:

There is one catch, and it matters a lot: the reverse is not true. If A has a smaller timestamp than B, A may have caused B, or A and B may simply be unrelated events on different machines.

This chapter explains the algorithm, the clock condition, total ordering with a tie-breaker, and the places where Lamport timestamps are helpful in real systems.

1. The Algorithm

Premium Content

This content is for premium members only.