A Theoretical Perspective

This lesson will explain the theoretical perspective of time.

What we have demonstrated so far is a rather practical and simplified version of the notion of time.

While there is an absolute, universal notion of time, it’s practically impossible to measure it in a completely precise way. In reality, there is no such absolute and universal notion of time.

Laws of physics

According to the laws of physics, more specifically the special theory of relativity, it is impossible to absolutely state that two distinct events occur at the same time if those events are separated in space.

For example, a car crash in London and another in New York that appear to happen at the same time to an observer on Earth will appear to have occurred at slightly different times to an observer on an airplane flying between London and New York.

This can look like a paradox, but we can easily understand the reasoning behind this theory via a thought experiment known as the train experiment.

Train experiment

This experiment consists of a train with an observer in the middle of the carriage, and another observer standing on the platform as the train passes by. Then, there is a flash of light in the middle of the carriage, at the point when the two observers see each other. For the observer inside the carriage, both sides of the carriage have the same distance from the middle, so the light will reach both sides at the same time. For the observer standing on the platform, the rear side is moving towards the initial point of the flash, while the front side is moving away from it, so the light will reach the two sides at different points in time. This is because the speed of light is the same for all directions.

As a result, whether two spatially separated events happen at the same time (simultaneously) is not absolute but depends on the observer’s reference frame.

Below is an illustration of the train experiment.

Relativity in computing systems

In the context of this course, this experiment mainly serves to underline the fact that time is relative, and there can be no absolute, universal time dimension in a distributed system.

It also gives rise to another observation that forms the basis of distributed algorithms, that provide solutions to ordering problems without relying on a global clock.

We will cover these algorithms in more detail in the next chapter.

As illustrated in the previous example, information in the real world flows through light. If the sun stops shining, a human will realize that a bit later around 8 minutes later, to be exact. This is the time it takes sunlight to reach Earth from the sun. If we think about it, distributed systems are very similar. Events happen at different nodes of the system, and it takes some time for other nodes of the system to recognize that these events happened.

A difference worth pointing out is that the speed of light is constant, but the speed with which information flows in a distributed system is variable. This is because it depends on the underlying infrastructure and conditions of the network.

In the worst-case scenario, information might not be able to flow between two parts of a system at all because of a network partition.

Get hands-on with 1400+ tech skills courses.