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 ≠ ∅
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
- Any site Si is contained in exactly K sets.
N = K(K - 1) +1 and |Ri| = √N
- 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
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.
- Synchronization delay is equal to twice the message propagation delay time
- It requires 3√n messages per critical section execution.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Ricart–Agrawala Algorithm in Mutual Exclusion in Distributed System
- Lamport's Algorithm for Mutual Exclusion in Distributed System
- Suzuki–Kasami Algorithm for Mutual Exclusion in Distributed System
- Mutual exclusion in distributed system
- Peterson's Algorithm for Mutual Exclusion | Set 1 (Basic C implementation)
- Peterson's Algorithm for Mutual Exclusion | Set 2 (CPU Cycles and Memory Fence)
- Mutual Exclusion in Synchronization
- Difference between Local File System (LFS) and Distributed File System (DFS)
- Algorithm for implementing Distributed Shared Memory
- Chandy-Misra-Haas's Distributed Deadlock Detection Algorithm
- Hierarchical Deadlock Detection in Distributed System
- Difference between Token based and Non-Token based Algorithms in Distributed System
- Limitation of Distributed System
- Features of Distributed Operating System
- Various Failures in Distributed System
- Logical Clock in Distributed System
- Hashing in Distributed Systems
- Deadlock detection in Distributed systems
- Deadlock Detection in Distributed Systems
- Advantages of Distributed database
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.