The Concept of Causality

Learn the concept of causality in general and also in distributed systems.

We'll cover the following

Total ordering in natural phenomena

As humans, we grow accustomed to total ordering, because most of the natural phenomena around us appear to be subject to it.

When we go shopping, we are placed in a queue to be served in a total order.

Similarly, cars waiting for the signal to change at an intersection are also ordered in the same way.

However, there are scenarios especially prevalent in software systems where a total ordering is not really necessary.

Causal ordering using logical clocks

For instance, look at some of the social media platforms people use nowadays, where they can create posts and add comments to the posts of other people. Do we really care about the order in which two unrelated posts are shown to us? Probably not. As a result, the system could potentially leverage a partial ordering, where posts that can’t really be ordered are displayed in an arbitrarily chosen order.

However, there is still a need to preserve the order of some events that are tightly linked. For example, if a comment CBC_B is a reply to a comment CAC_A, then we would most probably like to see CBC_B after CAC_A. Otherwise, a conversation could end up being confusing and hard to follow.