Focusing on Causality

Learn how to use the time to generate a unique ID and also maintain the causality of events.

Some applications need that events be given identifiers that is not only unique but also carry any causality information. An example is giving an identifier to the concurrent writes of a key into a key-value store to implement the last-write-wins strategy.

We can either use logical or physical clocks to infer causality (There are many subtleties associated with both of them. See the following optional text “Time in a Distributed System”). Some systems have additional requirements that event identifiers’ causality maps to wall-clock time. An example is a financial application complying with European MiFID regulations. MiFID requires clocks to be within 100 micro-seconds of UTC to detect any anomalies during high-volume / high-speed market trades.

We use time to determine the sequence of events in our life. For example, if Sam took a bath at 6 A.M. and took breakfast at 7:00 A.M., we can determine that Sam took a bath before the breakfast by timestamps of each event. Timestamps, therefore, can be used to maintain causality.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy