Ricart–Agrawala algorithm

This is an old revision of this page, as edited by Bluebot (talk | contribs) at 10:33, 7 March 2006 (Bringing "External links" and "See also" sections in line with the Manual of Style using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The Ricart-Agrawala Algorithm is an algorithm for mutual exclusion on a distributed system. This algorithm is an extension and optimization of Lamport's Distributed Mutual Exclusion Algorithm, by removing the need for messages.

Algorithm

Terminology

  • A site is any computing device which is running the Ricart-Agrawala Algorithm
  • For any one request of the critical section:
    • The requesting site is the site which is requesting entry into the critical section.
    • The receiving site is every other site which is receiving the request from the requesting site.
  • ts refers to the local timestamp of the system according to its logical clock.

Algorithm

Requesting Site:

  • A requesting site   sends a message   to all sites.

Receiving Site:

  • Upon reception of a   message, the receiving site   will immediately send a timestampped   message if and only if:
    •   is not requesting or executing the critical section OR
    •   is requesting the critical section but sent a request with a higher timestamp than the timestamp on  
  • Otherwise,   will defer the   message.

Critical Section:

  • Site   enters its critical section only after receiving all   sends all deferred   messages.

Performance

  • Number of network messages; 2*(N-1)
  • Synchronization Delays: One message propagation delay

Common Optimizations

Once site   has received a   message from site  , site   may enter the critical section without receiving permission from   until   has sent a   message to  

See also