{
  "id": "enwiki-001306919367",
  "slug": "maekawa-s-algorithm",
  "title": "Maekawa's algorithm",
  "qid": "",
  "lead": "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.",
  "body": "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== ===Algorithm=== Requesting site: A requesting site P_i sends a message \\text{request}(ts, i) to all sites in its quorum set R_i . Receiving site: Upon reception of a \\text{request}(ts, i) message, the receiving site P_j will: If site P_j does not have an outstanding \\text{grant} message (that is, a \\text{grant} message that has not been released), then site P_j sends a \\text{grant}(j) message to site P_i . If site P_j has an outstanding \\text{grant} message with a process with higher priority than the request, then site P_j sends a \\text{failed}(j) message to site P_i and site P_j queues the request from site P_i . If site P_j has an outstanding \\text{grant} message with a process with lower priority than the request, then site P_j sends an \\text{inquire}(j) message to the process which has currently been granted access to the critical section by site P_j . (That is, the site with the outstanding \\text{grant} message.) Upon reception of a \\text{inquire}(j) message, the site P_k will: Send a \\text{yield}(k) message to site P_j if and only if site P_k has received a \\text{failed} message from some other site or if P_k has sent a yield to some other site but have not received a new \\text{grant} . Upon reception of a \\text{yield}(k) message, site P_j will: Send a \\text{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. Place P_k into its request queue. Upon reception of a \\text{release}(i) message, site P_j will: Delete P_i from its request queue. Send a \\text{grant}(j) message to the request on the top of its request queue. Critical section: Site P_i enters the critical section on receiving a \\text{grant} message from all sites in R_i . Upon exiting the critical section, P_i sends a \\text{release}(i) message to all sites in R_i . Quorum set ( R_x ): A quorum set must abide by the following properties: \\forall i \\,\\forall j\\, [R_i \\bigcap R_j \\ne \\empty ] \\forall i\\, [ P_i \\in R_i ] \\forall i\\, [ |R_i| = K ] Site P_i is contained in exactly K request sets Therefore: |R_i| \\geq \\sqrt{N-1} ===Performance=== Number of network messages; 3 \\sqrt{N} to 6 \\sqrt{N} Synchronization delay: 2 message propagation delays The algorithm can deadlock without protections in place. ==See also== Lamport's bakery algorithm Lamport's Distributed Mutual Exclusion Algorithm Ricart–Agrawala algorithm Raymond's algorithm ==References== M. Maekawa, \"A √N algorithm for mutual exclusion in decentralized systems”, ACM Transactions in Computer Systems, vol. 3., no. 2., pp. 145–159, 1985. Mamoru Maekawa, Arthur E. Oldehoeft, Rodney R. Oldehoeft (1987). Operating Systems: Advanced Concept. Benjamin/Cummings Publishing Company, Inc. B. Sanders (1987). The Information Structure of Distributed Mutual Exclusion Algorithms. ACM Transactions on Computer Systems, Vol. 3, No. 2, pp.&nbsp;145–59.",
  "categories": [
    "48254570"
  ],
  "license": "CC BY-SA 4.0",
  "source_uri": "https://en.wikipedia.org/w/index.php?oldid=1306919367",
  "content_hash": "",
  "created_at": null,
  "updated_at": 1755687192.0,
  "claims": [],
  "contradictions": [],
  "confidence": 0.6,
  "csl": {
    "id": "enwiki-001306919367",
    "type": "webpage",
    "title": "Maekawa's algorithm",
    "author": [
      {
        "family": "Anticloud FZ LLE",
        "literal": "Anticloud FZ LLE"
      }
    ],
    "container-title": "encyclopegia.org",
    "publisher": "Anticloud FZ LLE",
    "publisher-place": "Dubai, United Arab Emirates",
    "URL": "https://encyclopegia.org/a/maekawa-s-algorithm",
    "issued": {
      "date-parts": [
        [
          2026,
          11,
          21
        ]
      ]
    },
    "accessed": {
      "date-parts": [
        [
          2026,
          11,
          21
        ]
      ]
    },
    "license": "CC BY-SA 4.0",
    "DOI": "eo1:enwiki-001306919367",
    "isBasedOn": "https://en.wikipedia.org/w/index.php?oldid=1306919367",
    "note": "Immutable snapshot enwiki-001306919367"
  }
}