Open In App

Maekawa’s Algorithm for Mutual Exclusion in Distributed System

Last Updated : 13 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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 request permission from every other site but from a subset of sites which is called quorum. In this algorithm:

  • Three type of messages ( REQUEST, REPLY and RELEASE) are used.
  • A site send a REQUEST message to all other site in its request set or quorum to get their permission to enter critical section.
  • A site send a REPLY message to requesting site to give its permission to enter the critical section.
  • A site send a RELEASE message to all other site in its request set or quorum upon exiting the critical section.

The construction of request set or Quorum: A request set or Quorum in Maekawa’s algorithm must satisfy the following properties:

∀i ∀j : i ≠ j, 1 ≤ i, j ≤ N :: Ri ⋂ Rj ≠ ∅ 
  1. i.e there is at least one common site between the request sets of any two sites.
∀i : 1 ≤ i ≤ N :: Si ∊ Ri 
∀i : 1 ≤ i ≤ N :: |Ri| = K 
  1. Any site Si is contained in exactly K sets.
N = K(K - 1) +1 and |Ri| = √N 

Algorithm:

  • To enter Critical section:
    • When a site Si wants to enter the critical section, it sends a request message REQUEST(i) to all other sites in the request set Ri.
    • When a site Sj receives the request message REQUEST(i) from site Si, it returns a REPLY message to site Si if it has not sent a REPLY message to the site from the time it received the last RELEASE message. Otherwise, it queues up the request.
  • To execute the critical section:
    • A site Si can enter the critical section if it has received the REPLY message from all the site in request set Ri
  • To release the critical section:
    • When a site Si exits the critical section, it sends RELEASE(i) message to all other sites in request set Ri
    • When a site Sj receives the RELEASE(i) message from site Si, it send REPLY message to the next site waiting in the queue and deletes that entry from the queue
    • In case queue is empty, site Sj update its status to show that it has not sent any REPLY message since the receipt of the last RELEASE message

Message Complexity: Maekawa’s Algorithm requires invocation of 3√N messages per critical section execution as the size of a request set is √N. These 3√N messages involves.

  • √N request messages
  • √N reply messages
  • √N release messages

Drawbacks of Maekawa’s Algorithm:

  • This algorithm is deadlock prone because a site is exclusively locked by other sites and requests are not prioritized by their timestamp.

Performance:

  • Synchronization delay is equal to twice the message propagation delay time
  • It requires 3√n messages per critical section execution.

Advantages of Maekawa’s Algorithm:

  • Low Message Complexity: Maekawa’s algorithm requires only O(sqrt(N)) messages per critical section invocation, where N is the total number of processes in the system. This makes it more efficient than many other distributed mutual exclusion algorithms.
  • Scalability: The algorithm is highly scalable and can be used in large-scale distributed systems without any problems.
  • Fairness: The algorithm provides fairness by allowing only one process per group to enter the critical section. It guarantees that every process will eventually get a chance to enter the critical section.

Disadvantages of Maekawa’s Algorithm:

  • High Overhead: The algorithm requires a lot of overhead to maintain the group membership information and to update it when a process joins or leaves the system. This can lead to increased network traffic and latency.
  • Limited Flexibility: The algorithm requires a fixed number of groups to be defined before the system starts running. This makes it less flexible than other algorithms that can dynamically adjust to changes in the system.
  • Delayed Execution: The algorithm can lead to delays in the execution of critical sections because a process may have to wait for messages to arrive from other groups before entering the critical section.

Similar Reads

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
Mutual exclusion in distributed system
Mutual exclusion is a concurrency control property which is introduced to prevent race conditions. It is the requirement that a process can not enter its critical section while another concurrent process is currently present or executing in its critical section i.e only one process is allowed to execute the critical section at any given instance of
5 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. [caption width="800"]Deadlock[/caption]A Distributed System is a Network of Machines that can exchange information with each o
4 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
Distributed Consensus in Distributed Systems
A procedure to reach a common agreement in a distributed or decentralized multi-agent platform. It is important for the message passing system. Example - A number of processes in a network decide to elect a leader. Each process begins with a bid for leadership. In traditional or conventional distributed systems, we apply consensus to ensure reliabi
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
Bully Algorithm in Distributed System
Operating Systems play a critical role in managing and coordinating the activities of a computer system. In distributed systems, where multiple computers work together to achieve a common goal, the issue of node/process failure becomes a significant concern. To ensure the reliability and fault tolerance of a distributed system, leader election algo
4 min read
Article Tags :