Maekawa’s Algorithm

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 ( REQUESTREPLY 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:

1.      ∀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.

2.      ∀i : 1 ≤ i ≤ N :: Si ∊ Ri

3.      ∀i : 1 ≤ i ≤ N :: |Ri| = K

4.      Any site Si is contained in exactly K sets.

5.      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

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.

Related Posts

© 2024 Basic Computer Science - Theme by WPEnjoy · Powered by WordPress