Ricart–Agrawala algorithm


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. It was developed by Glenn Ricart and Ashok Agrawala.

Algorithm

Terminology

Requesting Site
Receiving Site
Critical Section:
Once site has received a message from site, site may enter the critical section multiple times without receiving permission from on subsequent attempts up to the moment when has sent a message to. This is called Roucairol-Carvalho optimization or Roucairol-Carvalho algorithm.

Problems

One of the problems in this algorithm is failure of a node. In such a situation a process may starve forever.
This problem can be solved by detecting failure of nodes after some timeout.