Concepts
Logical clocks and happened-before
Intuition
Imagine two people in different cities who communicate only by letters, and whose wristwatches never match exactly. If one asks who did something first, the time on each person's watch is not much help. What you can state with confidence is something else: if a letter left A and arrived at B, what A did before sending comes before what B did after reading. When no chain of letters connects two events, asking which came first simply has no answer.
How it works
Lamport defines the happened-before relation with two rules: within a single process, the event that comes earlier in the execution happens before the next one; and the sending of a message happens before its receipt. The relation is transitive, which gives a strict partial order. Two events that are not linked by any path of sequential events and messages are concurrent: neither could have influenced the other. To make this computable, each event receives a logical timestamp such that, if A happened before B, A's number is smaller than B's. Each process keeps a counter, increments it before each local event (including a send), and attaches the value to the message; on receipt, it sets the counter to the larger of its own and the message's and then increments it. Equal timestamps on different processes are broken by an arbitrary ordering of the processes (such as an identifier), producing a total order consistent with causality. The guarantee holds in one direction only: a smaller timestamp does not prove that an event happened before, since the two may be concurrent, and the tie-break is artificial. Vector clocks generalize the idea and recover the reverse direction, making it possible to conclude causality or concurrency by comparing two clocks.
In practice
The total order of logical clocks is the basis of the replicated state machine idea: if deterministic replicas process the same inputs in the same order, they reach the same decisions; Lamport also uses it for mutual exclusion without a central coordinator. Dynamo applies the vector version: it tags each version of an object with a vector clock, which makes it possible to tell whether one version causally descends from another or whether they conflict, and returns to the client the versions it cannot order so the application can merge them. Use this reasoning whenever you need to distinguish true causal order from coincidence of observation without relying on synchronized physical clocks.
Use it in a design
Practice the cases that rely on this concept in the System Design school.