Causality is the relationship between a cause and effect. In distributed systems, ordering of events is challenging, as timestamps across nodes cannot be compared. This is where causality is useful in the distributed system.
Let’s define an event as something happening at one node. This something can be either sending or receiving a message or a local execution step.
An Event A is said to have happened before an Event B if, and only if, the following holds true:
The happens-before relationship is a way to determine causality in a distributed system.
In the figure above, we see:
Thus, we have a causal relationship A -> B -> C -> D -> E.
As there is no chain of events that can determine a relationship between A and F, we say that A||F, which means A is concurrent with F.
The event ordering process in the distributed system uses the notion of causality. This forms the base for most distributed system algorithms.