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 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
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.
Please Login to comment...