Wave and Traversal Algorithm in Distributed System
Last Updated :
07 Nov, 2023
As we know a distributed system is a collection where different processes in order to perform a task communicate with each other. In wave algorithm exchange of messages and decision take place, which depends on the number of messages in each event of a process. As it is important to traverse in a connected network Wave algorithm has applications in many fields such as Distributed Databases, Wireless Networks, etc.
Notation
- Computations(C) in a process is denoted ICI
- Any subset of the process(p) in computation(C) is denoted Cp.
- The set of all processes is denoted by P',
- The set of channels by E.
- The node from where the process starts is called Initiators or starters.
- Any Non-initiators node in a network called followers.
- The event of an initiator is to send an event
- The event of a non-initiator has received the event.
Wave Algorithm
Message Passing Schemes (Algorithms) are called wave algorithms in means asynchronous message passing no global clock or time.
A wave algorithm exchanges finite number of messages and then makes a decision which depends casually on some event in each process.
An Algorithm that satisfies the three requirements is considered as a Wave Algorithm in a distributed algorithm:
- Termination: Each computation is finite.
- Decision: Each computation contains at least one decision event.
- ∀C: ∃e ∈ C: e is a decisive event.
- Dependence: In each computation, each decided event is casually preceded by an event in each process.
- ∀C: ∀e ∈ C : (e is a decide event ⇒ ∀q ∈ P' ∃f ∈Cq: f ≥ e).
A wave algorithm starts from a particular process and the wave propagates to its neighbors, and neighbors propagate to their neighbors, and so on. When there are no further nodes to propagate wave returns back.

The strength of the Wave Algorithm lies in the asynchronous Communication where there is an equivalence lies between the casual and message chains. In wave algorithms, the existence of message chains is required for the computation of causal dependency. Wave algorithms can differ from each other on the basis of the following properties:
- Centralization: algorithm differs from each other if they have one initiator or more than one initiator.
- An algorithm has exactly one initiator in each computation is called centralized,
- If the algorithm can be started spontaneously by an arbitrary subset of the processes called decentralized.
- Initial Knowledge: An algorithm differs from one another if they have initial knowledge in the processes.
- Process Identity: Each process has its unique name.
- Neighbor Identity: Each process knows his neighbor's name.
- Complexity: The complexity of the algorithm considers
- the number of exchanged messages
- the number of exchanged bits,
- the time needed for one computation.
- Topology: An algorithm may be designed for a specific topology such as ring, tree, clique, etc.
- Number of decisions: Normally one decision occurs in each process. In some algorithms only one process may execute decide event whereas in some algorithms all processes decide. The tree algorithm cause a decision in exactly two processes.
Properties of waves:
- Each event in computation is preceded by an event in an initiator.
- A wave algorithm for arbitrary networks without initial knowledge of the neighbor's identities. Then algorithm exchanges at least lEI messages in each computation.
Since propagation of packets is done by the wave network of nodes and it can be treated as partial order relation,
Now, Consider a binary relation ≤* by x ≤* y ⇐⇒ (x * y) = x, i.e.; in the relation ≤* is a partial order on X, i.e., that this relation is transitive, antisymmetric, and reflexive.
- Transitivity: We know x≤ y and y≤ z then x≤ z, Assume x ≤* y and y ≤* z; by definition of ≤*, (x*y) = x and (y*z) = y. Using these and associativity we find (x * z) = (x * y) * z = x * (y * z) = x * y = x, i.e., x ≤* z.
- Antisymmetry: Assume x ≤* y and y ≤* x; by definition of ≤*, x * y = x and y * x = y. Using these and commutativity we find x = y.
- Reflexivity: x * x = x, i.e., x ≤* x, the reflexive property can be proved using idempotency.
Since it satisfies all three properties hence we conclude wave algorithm can be treated as the Partial order relation.
Different Wave Algorithm
- Ring algorithm
- Polling algorithm
- Tree algorithm
- Echo algorithm
- Phase algorithm
- Finn's algorithm
The Ring Algorithm
The channel for the propagation of the process is selected such that it forms a Hamiltonian cycle(all the nodes traversed). In other words, the process (p) and its neighbor (Nextp) is given such that channels selected in this way form a Hamiltonian cycle(all the nodes traversed).
- It has only one initiator.
- Each other node passes the message forward.
- Ring Algorithm is Centralized.
- The initiator is the deciding node.
For initiator-
begin
send (tok) to Nextp;
receive (tok);
decide;
end
Ring algorithm for non initiator-
begin
receive (tok);
send (tok) to Nextp;
end
The Polling Algorithm
The algorithm will send out a wave that will reach all the nodes and will come back to the originator and when the wave is subsided then the algorithm will terminate.
- It works on a clique network.
- It has only one initiator.
- Polling Algorithm is Centralized.
- The initiator is the deciding node.
In the polling algorithm, the initiator asks each neighbor to reply with a message and decides after receipt of all messages.
Polling algorithm for Initiator-
var recp: integer init 0;
begin
for all q Neighp
do send (tok)to qf;
while recp<#Neighp do
begin
receive(tok);
recp:= recp + 1;
end
decide
end
// here recp is used as a count variable
Polling algorithm for non Initiator-
begin
receive (tok)from qf;
send (tok) to q;
end
Polling can also be used in a star network in which the initiator is the center.
Note: Wave Algorithm used for all of the fundamental tasks i.e., broadcasting, synchronization, and computing global functions.
The Tree Algorithm
Characteristics of algorithm are as follows:
- Non centralized wave algorithm for (1) tree network (2) arbitrary network if a spanning tree is available.
- If a process has received a message via each of incident channel except one, the process sends a message via remaining channel.
- More than one process may decide.
- The tree algorithm causes a decision in exactly two process.
Tree Algorithm:
Boolean rec {q} for each q ϵ Neigh
Begin while ≠ {q: recp {q} is false > 1 do
Begin receive <tok> from q : recp [q] = true
End
Send <tok> to q0
Receive <tok> from q0
Recp [q0] = true decide
For all q . Neigh send <tok> to q
End
Example:
In the tree network shown, there are two process that receives a message via each of their channel and decide. The other processes are still waiting for message with their program counter pointing at x in the terminal configuration.
Tree algorithm
we get rec1(12) = True; rec5(6) = true; rec3(4) = true; rec9(7) = true; rec9(8) = true; rec10(12) = true; rec11(12) = true;
Because the node 1,3,5,7,8,10,11 are terminal node
rec13(12) = true because node 12 sends a message to node 13(as it has received a message via each of its incident channels except one that is (13). Node receives message from each of its incident channel (2,4,6,9) except 13.
The Echo Algorithm
The characteristics of this algorithm are:
- Centralized wave algorithm for network of arbitrary topology.
- First notice that wave with one initiator defines as spanning tree take the parent channel to be one through which the first message is received.
- Initiator send the message to all its neighbor
- Upon receipt of the first message a non-initiative forward message to all its Neighbour except the one from which the message was received.
- When the initiator has received echo message from all its Neighbour it decides.
Echo algorithm for initiator:
Begin for all q.neigh do
Send <tok> to q;
While receivesp < Neighp do
Begin receives <tok> ; recp = recp+1 end;
End
Decide
End
Echo algorithm for non-initiators:
Begin receives <tok> from neighbour q ;
Father = q
recp = recp + 1
for all q ϵ neighp : q ≭ fatherp do
Send <tok> to q
While recp < ≭ Neighp do
Begin receives <tok>p
recp = recp + 1
End
Send <tok> to fatherp
End
The Phase Algorithm
It is a decentralized algorithm for network of arbitrary topology.
This can be used as wave algorithm for directed networks.
The algorithm requires that the process know the diameter D of the network.
The algorithm is also correct if the process uses instead of D, a constant D larger than the network diameter. Thus, in order to apply this algorithm, it is not necessary that diameter is known exactly, it suffices if the upper (i.e., N-1) on the network diameter is known.
As it can be used in arbitrary, directed networks where channels can carry messages in one direction only, the Neighbours of node p are:
- In-Neighbor : Process that can send message to p
- Out-Neighbor : Process to which p can send messages
In phase algorithm, each process sends exactly D messages to each out-neighbor. Only after I messages have been received from each in-neighbor,(I + 1)th message is sent to each out-neighbor.
The Finn's Algorithm
This is another wave algorithm that can be used in arbitrary directed networks.
It does not require the diameter of the network to be known in advance but relieve on the availability of the unique identities for the processes.
Set of processes identities are exchanged in messages, which causes the bit complexity of the algorithm to be rather high.
Process p maintains two set of process identities:
- Incp : Is the set of processes q such that an event in q precedes the most recent event in p.
- Nincp : Is the set of processes q such that for all neighbors r of q an event in precedes the most recent event in p.
Traversal Algorithm
Wave algorithms have the following two additional properties:
- the initiator is the only process that decides
- all events are ordered totally by the participant in cause-effect order.
Wave algorithms with these properties are called traversal algorithms. or Traversal Algorithm if it satisfies these properties:
- In each computation, there is one initiator, which starts the algorithm by sending out exactly one message.
- A process, upon receipt of a message, either sends out one message or decides.
- Each process has sent a message at least once, then the algorithm terminates in the initiator.
Example of Traversing Algorithm:
Sequential Polling Algorithm: Sequence Polling Algorithm is the same as Polling Algorithm.
- One neighbor is polled at a time.
- The next neighbor is polled only when the reply of a previous neighbor is received.
Sequential Polling algorithm for Initiator-
var recp: integer init 0;
begin
while recp<#Neighp do
begin
send(tok)to qrecp+1;
receive(tok);
recp:= recp + 1;
end;
decide
end
Sequential Polling algorithm for non Initiator-
begin
receive (tok)from q;
send (tok) to q;
end
Note: Traversal Algorithms are used to construct Election Algorithms.
Topology
- Ring: It is a circular network structure where each network is connected with exactly two networks.
- Tree: It is a type of hierarchical topology where the root network is connected to all other networks and there is a minimum of three levels of hierarchy.
- Clique: Network channel is present between each pair of processes.
The metrics for measuring the efficiency of algorithms are:
- Time complexity is the number of messages in the longest chain.
- Message complexity is the number of messages carried out by an algorithm.
Here is a table showing different algorithms with their properties:
- N is the number of processes
- lEI the number of channels
- D the diameter of the network (in hops).
- DFS - Depth First Search
|
01.
| Ring
| ring
| C
| no
| N
| N
|
02.
| Tree
| tree
| D
| no
| N
| O(D)
|
03.
| Echo
| arbitrary
| C
| no
| 2|E|
| O(N)
|
04.
| Polling
| clique
| C
| no
| 2N-2
| 2
|
05.
| Finn
| arbitrary
| D
| no
| <=4.N.|E|
| O(D)
|
06.
| Sequence Polling
| clique
| C
| yes
| 2N-2
| 2N-2
|
07.
| Classical DFS
| arbitrary
| C
| yes
| 2|E|
| 2|E|
|
Similar Reads
Distributed Systems Tutorial A distributed system is a system of multiple nodes that are physically separated but linked together using the network. Each of these nodes includes a small amount of the distributed operating system software. Every node in this system communicates and shares resources with each other and handles pr
8 min read
Basics of Distributed System
What is a Distributed System?A distributed system is a collection of independent computers that appear to the users of the system as a single coherent system. These computers or nodes work together, communicate over a network, and coordinate their activities to achieve a common goal by sharing resources, data, and tasks.Table o
7 min read
Types of Transparency in Distributed SystemIn distributed systems, transparency plays a pivotal role in abstracting complexities and enhancing user experience by hiding system intricacies. This article explores various types of transparencyâranging from location and access to failure and securityâessential for seamless operation and efficien
6 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 tr
10 min read
Difference between Hardware and MiddlewareHardware and Middleware are both parts of a Computer. Hardware is the combination of physical components in a computer system that perform various tasks such as input, output, processing, and many more. Middleware is the part of software that is the communication medium between application and opera
4 min read
Difference between Parallel Computing and Distributed ComputingIntroductionParallel Computing and Distributed Computing are two important models of computing that have important roles in todayâs high-performance computing. Both are designed to perform a large number of calculations breaking down the processes into several parallel tasks; however, they differ in
5 min read
Difference between Loosely Coupled and Tightly Coupled Multiprocessor SystemWhen it comes to multiprocessor system architecture, there is a very fine line between loosely coupled and tightly coupled systems, and this is why that difference is very important when choosing an architecture for a specific system. A multiprocessor system is a system in which there are two or mor
5 min read
Design Issues of Distributed SystemDistributed systems are used in many real-world applications today, ranging from social media platforms to cloud storage services. They provide the ability to scale up resources as needed, ensure data is available even when a computer fails, and allow users to access services from anywhere. However,
8 min read
Communication & RPC in Distributed Systems
Features of Good Message Passing in Distributed SystemMessage passing is the interaction of exchanging messages between at least two processors. The cycle which is sending the message to one more process is known as the sender and the process which is getting the message is known as the receiver. In a message-passing system, we can send the message by
3 min read
What is Message Buffering?Remote Procedure Call (RPC) is a communication technology that is used by one program to make a request to another program for utilizing its service on a network without even knowing the network's details. The inter-process communication in distributed systems is performed using Message Passing. It
6 min read
Group Communication in Distributed SystemsIn distributed systems, efficient group communication is crucial for coordinating activities among multiple entities. This article explores the challenges and solutions involved in facilitating reliable and ordered message delivery among members of a group spread across different nodes or networks.G
8 min read
What is Remote Procedural Call (RPC) Mechanism in Distributed System?A remote Procedure Call (RPC) is a protocol in distributed systems that allows a client to execute functions on a remote server as if they were local. RPC simplifies network communication by abstracting the complexities, making it easier to develop and integrate distributed applications efficiently.
9 min read
Stub Generation in Distributed SystemA stub is a piece of code that translates parameters sent between the client and server during a remote procedure call in distributed computing. An RPC's main purpose is to allow a local computer (client) to call procedures on another computer remotely (server) because the client and server utilize
3 min read
Server Management in Distributed SystemEffective server management in distributed systems is crucial for ensuring performance, reliability, and scalability. This article explores strategies and best practices for managing servers across diverse environments, focusing on configuration, monitoring, and maintenance to optimize the operation
12 min read
Difference Between RMI and DCOMIn this article, we will see differences between Remote Method Invocation(RMI) and Distributed Component Object Model(DCOM). Before getting into the differences, let us first understand what each of them actually means. RMI applications offer two separate programs, a server, and a client. There are
2 min read
Synchronization in Distributed System
Source & Process Management
What is Task Assignment Approach in 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. In this article, we will see the concept of the Task Assignment Approach in Distributed systems. Resource Management:One of the
6 min read
Difference Between Load Balancing and Load Sharing in Distributed SystemA distributed system is a computing environment in which different components are dispersed among several computers (or other computing devices) connected to a network. This article clarifies the distinctions between load balancing and load sharing in distributed systems, highlighting their respecti
4 min read
Process Migration in Distributed SystemProcess migration in distributed systems involves relocating a process from one node to another within a network. This technique optimizes resource use, balances load, and improves fault tolerance, enhancing overall system performance and reliability.Process Migration in Distributed SystemImportant
9 min read
Distributed Database SystemA distributed database is basically a database that is not limited to one system, it is spread over different sites, i.e, on multiple computers or over a network of computers. A distributed database system is located on various sites that don't share physical components. This may be required when a
5 min read
Multimedia DatabaseA Multimedia database is a collection of interrelated multimedia data that includes text, graphics (sketches, drawings), images, animations, video, audio etc and have vast amounts of multisource multimedia data. The framework that manages different types of multimedia data which can be stored, deliv
5 min read
Mechanism for Building Distributed File SystemBuilding a Distributed File System (DFS) involves intricate mechanisms to manage data across multiple networked nodes. This article explores key strategies for designing scalable, fault-tolerant systems that optimize performance and ensure data integrity in distributed computing environments.Mechani
8 min read
Distributed File System
What is DFS (Distributed File System)? A Distributed File System (DFS) is a file system that is distributed on multiple file servers or multiple locations. It allows programs to access or store isolated files as they do with the local ones, allowing programmers to access files from any network or computer. In this article, we will discus
8 min read
File Service Architecture in Distributed SystemFile service architecture in distributed systems manages and provides access to files across multiple servers or locations. It ensures efficient storage, retrieval, and sharing of files while maintaining consistency, availability, and reliability. By using techniques like replication, caching, and l
12 min read
File Models in Distributed SystemFile Models in Distributed Systems" explores how data organization and access methods impact efficiency across networked nodes. This article examines structured and unstructured models, their performance implications, and the importance of scalability and security in modern distributed architectures
6 min read
File Caching in Distributed File SystemsFile caching enhances I/O performance because previously read files are kept in the main memory. Because the files are available locally, the network transfer is zeroed when requests for these files are repeated. Performance improvement of the file system is based on the locality of the file access
12 min read
What is Replication in Distributed System?Replication in distributed systems involves creating duplicate copies of data or services across multiple nodes. This redundancy enhances system reliability, availability, and performance by ensuring continuous access to resources despite failures or increased demand.Replication in Distributed Syste
9 min read
What is Distributed Shared Memory and its Advantages?Distributed shared memory can be achieved via both software and hardware. Hardware examples include cache coherence circuits and network interface controllers. In contrast, software DSM systems implemented at the library or language level are not transparent and developers usually have to program th
4 min read
Consistency Model in Distributed SystemIt might be difficult to guarantee that all data copies in a distributed system stay consistent over several nodes. The guidelines for when and how data updates are displayed throughout the system are established by consistency models. Various approaches, including strict consistency or eventual con
6 min read
Distributed Algorithm
Advanced Distributed System
Flat & Nested Distributed TransactionsIntroduction : A transaction is a series of object operations that must be done in an ACID-compliant manner. Atomicity - The transaction is completed entirely or not at all.Consistency - It is a term that refers to the transition from one consistent state to another.Isolation - It is carried out sep
6 min read
Transaction Recovery in Distributed SystemIn distributed systems, ensuring the reliable recovery of transactions after failures is crucial. This article explores essential recovery techniques, including checkpointing, logging, and commit protocols, while addressing challenges in maintaining ACID properties and consistency across nodes to en
10 min read
Two Phase Commit Protocol (Distributed Transaction Management)Consider we are given with a set of grocery stores where the head of all store wants to query about the available sanitizers inventory at all stores in order to move inventory store to store to make balance over the quantity of sanitizers inventory at all stores. The task is performed by a single tr
5 min read
Scheduling and Load Balancing in Distributed SystemIn this article, we will go through the concept of scheduling and load balancing in distributed systems in detail. Scheduling in Distributed Systems:The techniques that are used for scheduling the processes in distributed systems are as follows: Task Assignment Approach: In the Task Assignment Appro
7 min read
Distributed System - Types of Distributed DeadlockA 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. DeadlockA Distributed System is a Network of Machines that can exchange info
4 min read
Difference between Uniform Memory Access (UMA) and Non-uniform Memory Access (NUMA)In computer architecture, and especially in Multiprocessors systems, memory access models play a critical role that determines performance, scalability, and generally, efficiency of the system. The two shared-memory models most frequently used are UMA and NUMA. This paper deals with these shared-mem
5 min read