FT 5 a& B Sec Answer Distributed Computing
FT 5 a& B Sec Answer Distributed Computing
CSE A & B
AND model: In the AND model, processes need all requested resources to proceed. The
algorithm efficiently detects deadlocks by propagating probes along the dependency chains.
OR model: In the OR model, a process can proceed if any one of its requested resources is
granted. The algorithm needs to handle more complex situations, but it's still effective.
Benefit: The algorithm is non-centralized, reduces communication overhead, and suits both models with
minimal modifications.
7. Outline the Chandy-Misra-Haas algorithm to detect deadlock in OR model and illustrate the
algorithm.
Chandy–Misra–Haas’s distributed deadlock detection algorithm for the OR model, which is based on
the approach of diffusion-computation
1. If this is the first query message received by Pk for the deadlock detection initiated by Pi
(called the engaging query), then it propagates the query toall the processes in its dependent
set and sets a local variable numki to the number of query messages sent.
2. If this is not the engaging query, then Pk returns a reply message to it immediately provided
Pk has been continuously blocked since it received the corresponding engaging query.
Otherwise, it discards the query.
Process Pk maintains a boolean variable waitki that denotes the fact that it has been
continuously blocked since it received the last engaging query from process Pi. When a blocked
process Pk receives a reply(i, j, k) message, it decrements numki only if waitki holds. A process
sends a reply message in response to an engaging query only after it has received a reply to
every
query message it has sent out for this engaging query.
The initiator process detects a deadlock when it has received reply messages to all the query
messages it has sent out.
The algorithm