0
18kviews
Explain Ricart- Agarwala algorithm for Mutual Exclusion.
1 Answer
5
1.6kviews

Ricart - Agarwala s a non token based algorithm that uses broadcast technique for mutual calculation.

Consider a scenario when process PO & P1 went to enter critical sector. Both P0 & P1 send broadcast to all 3 processes in the system along with time stamp.

enter image description here

Since P2 does not want to enter critical section hence it sends "OK" to both the processes.

enter image description here

Since P1 finds Ts of P0 to be lesser than Ts of self therefore P1 sends to P0.

enter image description here

Now P0 can enter critical section, as it is received (n-1) OK messages.

Once P0 is done with critical section, it sends "Ok" message to P1.

enter image description here

Now P1 can enter CS.

One of the problem with this algorithm is that once a process P1 receives "OK" from all (n-1) processes, it can enter CS subsequently without sending repeat message.

Secondly if the node having process fails then all other processes stare forever. this can be solved by detecting failure of nodes.

Please log in to add an answer.