Maekawa's algorithm explained

Maekawa's algorithm is an algorithm for mutual exclusion on a distributed system. The basis of this algorithm is a quorum-like approach where any one site needs only to seek permissions from a subset of other sites.

Algorithm

Terminology

Algorithm

Requesting site:

Pi

sends a message

request(ts,i)

to all sites in its quorum set

Ri

.

Receiving site:

request(ts,i)

message, the receiving site

Pj

will:

Pj

does not have an outstanding

grant

message (that is, a

grant

message that has not been released), then site

Pj

sends a

grant(j)

message to site

Pi

.

Pj

has an outstanding

grant

message with a process with higher priority than the request, then site

Pj

sends a

failed(j)

message to site

Pi

and site

Pj

queues the request from site

Pi

.

Pj

has an outstanding

grant

message with a process with lower priority than the request, then site

Pj

sends an

inquire(j)

message to the process which has currently been granted access to the critical section by site

Pj

. (That is, the site with the outstanding

grant

message.)

inquire(j)

message, the site

Pk

will:

yield(k)

message to site

Pj

if and only if site

Pk

has received a

failed

message from some other site or if

Pk

has sent a yield to some other site but have not received a new

grant

.

yield(k)

message, site

Pj

will:

grant(j)

message to the request on the top of its own request queue. Note that the requests at the top are the highest priority.

Pk

into its request queue.

release(i)

message, site

Pj

will:

Pi

from its request queue.

grant(j)

message to the request on the top of its request queue.

Critical section:

Pi

enters the critical section on receiving a

grant

message from all sites in

Ri

.

Pi

sends a

release(i)

message to all sites in

Ri

.

Quorum set (

Rx

):
A quorum set must abide by the following properties:

\foralli\forallj[RicapRj\ne\empty]

\foralli[Pi\inRi]

\foralli[|Ri|=K]

  1. Site

Pi

is contained in exactly

K

request sets

Therefore:

|Ri|\geq\sqrt{N-1}

Performance

3\sqrt{N}

to

6\sqrt{N}

See also

References

Transactions in Computer Systems, vol. 3., no. 2., pp. 145–159, 1985.

Notes and References

  1. Web site: Maekawa's Mutual Exclusion Algorithm: Voting approach.
  2. Web site: Distributed Mutual Exclusion.