The Wayback Machine - https://web.archive.org/web/20241114122335/https://www.geeksforgeeks.org/event-ordering-in-distributed-system/
Open In App

Event Ordering in Distributed System

Last Updated : 04 Mar, 2022
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

In this article, we will look at how we can analyze the ordering of events in a distributed system. As we know a distributed system is a collection of processes that are separated in space and which can communicate with each other only by exchanging messages this could be processed on separate computers or it could even be multiple processes within the same computer.

A defining characteristic is that the delay of transmitting a message is not negligible compared to the time between events in a single process. There is a fundamental limitation when it comes to ordering events in a distributed system and that is sometimes it is simply not possible to tell if one event occurred before another one if you take the complete set of events within a distributed system.

We can only at best define a partial ordering within those events or an intuitive understanding of the ordering of events is naturally associated with the time at which events occur.

However, in a distributed system we cannot count on physical clocks even if the computers themselves have physical clocks, because two clocks on two different systems can never be perfectly synchronized they will always, in reality, be some drift between any two physical clocks.

So, mostly physical time is ignored when it comes to ordering events within a distributed system, events are only observable within a system.

Now observable events are primarily sending and receiving of messages.

We are assuming that a single process is completely sequential in that we can take all the events within a single process and totally order them. So that we get the exact sequence in which those events occurred within that process.

  • An event is simply the sending or receiving of a message.
  • Now, partial ordering of events can be denoted by “⇢”, and we can define it as if – we have two events and be within the same process and a comes before b then a ⇢ b i.e.; a happened before b.
  • Now, if two processes are communicating with each other a is the sending of a message and b is the receipt of that message by another process then we define an as happening before b.
  • Lastly, we have a transitive property which says if a happened before b and b happened before c then a happened before c as well, a⇢b and b⇢ c then a⇢ c.
  • Since this is a partial ordering it could very well happen that for two events a and b neither happened before the other we simply cannot tell by looking at the observable events in the system and in that case we call a and b to have happened concurrently.

 Happened before example

  • P, Q, R are the process and each dot in the line denotes the events, the curve lines denote messages being sent between processes from this representation we can see relate p1 and r4 and we can say that p1 happened before r4 because p1 sent a message to Q and that was event q2 we move forward in time within the process Q we send a message to process R which was received over here at r3. So, we can say p1 happens before r4. and r2, q6 are concurrent as they cannot causally affect one another.
  • Happened before relation is an irreflexive partial ordering on the set of all events happening in the system i.e.; (a⇢ a) is not true for any event a.
  • This relates back to Einstein’s general theory of relativity where events are ordered in terms of messages that could possibly be sent.

Logical Clocks:

A logical clock is a way of assigning a number to an event where that number can be thought of as the time at which the event occurred and the notation we use here is Ci<a> of an event a, where C is used to denote Clock. These numbers are purely logical they do not have any relationship to physical time

Conditions For logical clocks:

  • If a happens before b the logical time of a should be lesser than the logical time of b of a process Pi
    • a⇢ b then C<a><C<b>
  • If a is the sending message by process Pi and b is the receipt of that message by Pj the
    • Ci<a><Cj<b>.
  • The logical clock is associated with timestamps.

So given these conditions, We define a clock function within a process by simply incrementing the process’s own clock as we go from event to event i.e.; Each process Pi increments Ci between any two successive events.

So, now we have a partial ordering of the events within a distributed system and we have a way to assign numbers to those events such that we can construct logical clocks out of them.


Previous Article
Next Article

Similar Reads

Causal Ordering of Messages in Distributed System
Causal ordering of messages is one of the four semantics of multicast communication namely unordered, totally ordered, causal, and sync-ordered communication. Multicast communication methods vary according to the message's reliability guarantee and ordering guarantee. The causal ordering of messages describes the causal relationship between a messa
4 min read
Distributed System - Thrashing in Distributed Shared Memory
In this article, we are going to understand Thrashing in a distributed system. But before that let us understand what a distributed system is and why thrashing occurs. In naive terms, a distributed system is a network of computers or devices which are at different places and linked together. Each one of these distributed computers shares the same s
4 min read
Distributed System - Types of Distributed Deadlock
A Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource occupied by some other process. When this situation arises, it is known as Deadlock. A Distributed System is a Network of Machines that can exchange information with each other through Message-passing. It can be
4 min read
Distributed Information Systems in Distributed System
Distributed systems consist of multiple independent computers working together as a unified system. These systems offer enhanced scalability, reliability, and fault tolerance. They ensure efficient resource utilization and performance by distributing tasks across various nodes. One crucial aspect is managing and sharing data effectively, which is t
9 min read
Distributed Ledger Technology(DLT) in Distributed System
Distributed Ledger Technology (DLT) is a way to record and share data across multiple computers, ensuring that all copies of the data are synchronized and secure. Unlike traditional databases controlled by a single entity, DLT allows for decentralized data storage and management. This makes it harder for data to be tampered with and increases trans
11 min read
Distributed Snapshots in Distributed System
Distributed snapshots are crucial for capturing the state of distributed systems at a specific point in time. They enable consistency and recovery, helping to maintain the integrity of the system amidst failures or concurrent operations. This article explores the concepts, techniques, properties, and challenges of distributed snapshots. Table of Co
6 min read
Distributed System vs. Distributed Computing
Distributed systems and distributed computing are foundational to modern technology, enabling complex tasks to be handled across multiple machines. While the two terms are often used interchangeably, they have distinct focuses. Distributed systems emphasize the coordination of independent components to work as a unified whole, ensuring reliability,
6 min read
Operating System - Difference Between Distributed System and Parallel System
A distributed system is a model where distributed applications are running on multiple computers linked by a communications network. Sometimes it is also called loosely coupled systems because in which each processor has its own local memory and processing units. LOCUS and MICROS are some examples of distributed operating systems. Parallel Systems
4 min read
Difference between a Distributed Lock Manager and a Distributed Database
In today’s world, managing data and resources efficiently across multiple locations is crucial. Distributed Lock Managers and Distributed Databases are foundational in achieving this. They serve different yet complementary roles in distributed systems. While a distributed lock manager coordinates access to shared resources, a distributed database h
5 min read
Distributed Consensus in Distributed Systems
In distributed systems, achieving consensus among nodes is critical for maintaining coherence and reliability. This article explores the principles, algorithms, challenges, and applications of distributed consensus, which are essential for ensuring agreement across decentralized networks. Important Topics for Distributed Consensus in Distributed Sy
11 min read
Distributed Task Queue - Distributed Systems
A Distributed Task Queue is a system used in distributed computing to manage and coordinate tasks across multiple machines or servers. Instead of one machine handling all tasks, a distributed task queue spreads out the work, making the process faster and more efficient. Each task is placed in a queue, and available workers pick up and complete task
11 min read
Distributed Garbage Collection in Distributed Systems
Distributed garbage collection is a technique used in distributed systems to manage memory efficiently across multiple computers. In a distributed system, different machines work together to perform tasks, and each machine has its own memory. As these machines create and use data, some of it becomes obsolete and needs to be removed to free up space
10 min read
Distributed File Systems vs Distributed Object Storage
As organizations scale their operations, the need for efficient and reliable data storage systems increases. Two prominent architectures that fulfill this need are Distributed File Systems (DFS) and Distributed Object Storage (DOS). While both systems provide scalable and redundant storage across multiple nodes, they differ significantly in their s
4 min read
Distributed System vs. Clustered System
When discussing scalability and reliability as well as performance in the context of computing, terms such as distributed systems and clustered systems are unavoidably mentioned. Even though they have a few common characteristics, they are two different ideas with different architectures and usage. It is important to understand the distinctions bet
5 min read
What is Scalable System in Distributed System?
In distributed systems, a scalable system refers to the ability of a networked architecture to handle increasing amounts of work or expand to accommodate growth without compromising performance or reliability. Scalability ensures that as demand grows—whether in terms of user load, data volume, or transaction rate—the system can efficiently adapt by
10 min read
Google File System(GFS) vs. Hadoop Distributed File System (HDFS)
In distributed file systems, Google File System (GFS) and Hadoop Distributed File System (HDFS) stand out as crucial technologies. Both are designed to handle large-scale data, but they cater to different needs and environments. In this article, we will understand the differences between them. Table of Content What is Google File System (GFS)? Key
6 min read
Distributed Data Structures for Real-time Event Processing
Real-time event processing is a critical aspect of distributed systems, as it allows for the immediate and accurate handling of data as it is generated. Distributed data structures play a vital role in this process, as they are used to efficiently store and manage the large amounts of data generated by these systems. In this article, we will explor
10 min read
Maekawa’s Algorithm for Mutual Exclusion in Distributed System
Prerequisite - Mutual exclusion in distributed systems Maekawa's Algorithm is quorum based approach to ensure mutual exclusion in distributed systems. As we know, In permission based algorithms like Lamport's Algorithm, Ricart-Agrawala Algorithm etc. a site request permission from every other site but in quorum based approach, A site does not reque
4 min read
Ricart–Agrawala Algorithm in Mutual Exclusion in Distributed System
Prerequisite: Mutual exclusion in distributed systems Ricart–Agrawala algorithm is an algorithm for mutual exclusion in a distributed system proposed by Glenn Ricart and Ashok Agrawala. This algorithm is an extension and optimization of Lamport's Distributed Mutual Exclusion Algorithm. Like Lamport's Algorithm, it also follows permission-based appr
3 min read
Lamport's Algorithm for Mutual Exclusion in Distributed System
Prerequisite: Mutual exclusion in distributed systems Lamport's Distributed Mutual Exclusion Algorithm is a permission based algorithm proposed by Lamport as an illustration of his synchronization scheme for distributed systems. In permission based timestamp is used to order critical section requests and to resolve any conflict between requests. In
5 min read
Suzuki–Kasami Algorithm for Mutual Exclusion in Distributed System
Prerequisite: Mutual exclusion in distributed systems Suzuki–Kasami algorithm is a token-based algorithm for achieving mutual exclusion in distributed systems.This is modification of Ricart–Agrawala algorithm, a permission based (Non-token based) algorithm which uses REQUEST and REPLY messages to ensure mutual exclusion. In token-based algorithms,
3 min read
Difference between Token based and Non-Token based Algorithms in Distributed System
A distributed system is a system in which components are situated in distinct places, these distinct places refer to networked computers which can easily communicate and coordinate their tasks by just exchanging asynchronous messages with each other. These components can communicate with each other to conquer one common goal as a task. There are ma
3 min read
Various Failures in Distributed System
DSM implements distributed systems shared memory model in an exceedingly distributed system, that hasn’t any physically shared memory. The shared model provides a virtual address space shared between any numbers of nodes. The DSM system hides the remote communication mechanism from the appliance author, protecting the programming ease and quality t
3 min read
Load-Sharing Approach in Distributed System
Load sharing basically denotes the process of forwarding a router to share the forwarding of traffic, in case of multiple paths if available in the routing table. In case there are equal paths then the forwarding process will follow the load-sharing algorithm. In load sharing systems, all nodes share the overall workload, and the failure of some no
6 min read
Types of Distributed System
Pre-requisites: Distributed System A Distributed System is a Network of Machines that can exchange information with each other through Message-passing. It can be very useful as it helps in resource sharing. It enables computers to coordinate their activities and to share the resources of the system so that users perceive the system as a single, int
8 min read
Difference Between Load Balancing and Load Sharing in Distributed System
A distributed system is a computing environment in which different components are dispersed among several computers (or other computing devices) connected to a network. These devices broke up the work and coordinated their efforts to do the job faster than if it had been assigned to a single device. Load Balancing:Load balancing is the practice of
2 min read
Deadlock Prevention Policies in Distributed System
A Deadlock is a situation where a set of processes are blocked because each process is holding a resource and waiting for a resource that is held by some other process. There are four necessary conditions for a Deadlock to happen which are: Mutual Exclusion: There is at least one resource that is non-sharable and can be used by only one Process at
4 min read
Process Addressing in Distributed System
In this article, we will go through the concept of addressing processes involved in communication in Distributed Systems in detail. In a Message-based communication system, another vital issue is to name or address the processes that are involved in communication. The following are the two types of addressing schemes supported by the Message Proces
4 min read
RPC Implementation Mechanism in Distributed System
In this article, we will go through the concept of the Remote Procedure Call (RPC) and its working mechanism. RPC is an effective mechanism for building client-server systems that are distributed. RPC enhances the power and ease of programming of the client/server computing concept. It's a protocol that allows one software to seek a service from an
5 min read
Distributed System - Call Semantics in RPC
This article will go through the Call Semantics, its types, and the issues in RPC in distributed systems in detail. RPC has the same semantics as a local procedure call, the calling process calls the procedure, gives inputs to it, and then waits while it executes. When the procedure is finished, it can return results to the calling process. If the
3 min read
three90RightbarBannerImg