Knapp's Classification
Knapp's Classification
Knapp's Classification
11 Knapp's Classification 2
All sites collectively cooperate Jo detect a cycle in the state graph that is likely to
T h e algorithm can be
initiated efther by the local site of the process or by the site
waits.
where the press
be detected by taking a snapshot of the system and
Distributed deadlocks
can
.
Algorithm
1. The site waits for deadlock-related information from other sites. e
2. The site combines the received information with its local TWF
graph to build
an
updated TWF graph.
Aloe
It then detects all cycles and breaks those
node 'Ex
only cycles which do not contain the
4. For all
cycles
'Ex Ti T2 Ex' which contain the node "Ex' the site transmits ,
them in string form 'Ex, Ti, T, Ex' to all other sites where an agent of T2 is
waiting for a resource being held by another transaction.
TECHNICAL PUBLICATIONS- An up thrust for knowledge
3- 21 Distributed Mutex and Deadlock
algorithm
reduces message traffic by lexically ordering transactions and
The
sending
the string Ex, T.
Ex' to other sites only if
T» T3, is higher than T3
T
lexical ordering.
in the
transaction detects the deadlock.
deadlock, the highest priority
.
For a
dapendsnbla,
dapeodnbla,
ex arkio .
exeud
eheck
Algorithms
511.2 Edge Chasing
denotes that the deadlock
U s e s a special
message known
as the ptobe (i,j,k)} (ij.k)
the process P and it is being sent by the home siteof
detection is initiated by
to the home site
of processP Proe
process P
travels
along the edges of the global TWF graph. A deadlock is
probe message
its|initiating)process.
detected if a probe message returnsjto that knows
for each process P, is maintained. If P
ABoolean array dependent,
G) is set to true. Otherwise it is false.
i s dependent it, dependent,
on
P1 initiates
Example: Consider given in Fig. 3.11.1. If process
system which
Proes deadlock detection, it sends probe (1, 3, 4) to $2 Since P6 is waiting
for P8 and
and (1, 7, 10) to $3 which in
turn
P7 is waiting
sends probe (
for
1,
P10. S2 sends probe ( 1, 6, 8)
9, 1) to
LauyciyoA.
S1. On receiving.probe ( 1, 9, 1), ^1
declares that P1 is
deadlocked.
PToL omto hd.
Protes moe
3
P1 launches
Probe (1, 9, 1) S1
ProbeT, 6, 8)
QP4
P8 inn
P9
P100
Probe (1, 7, 10) PT $2
$3
Fig. 3.11.1
S
Algorithm
then declare deadlock
IfPi is locally dependent
on itself
q f e value
such that
Else for all Pj and Pk and
upon Pj, oli
ffes.
So
Pi is locally dependent MON MgA
is waiting on Pk, and
Pj wi 3low
d
different sites,
Pj and Pk are on
site of Pk
to the home
Send probe(1j.k)
knowledge
thrust for
PUBLICATIONS An up
TECHNICAL
Lecltock oc
Distmbuted Systems 3- 22 Distributed Mutex and Deadlock
a c t i o n s - i n u a t ,
nb'ato auar
On receipt of probe(lj,k), the slte takes the followling actlons
If ndu
Pk is blocked, and ubu
dependentk(i) is false and u Cond qu
Pk has not
rlu uo u n e - >
replied to all requests of Pj,
then
begin
JocataP S6, a Van nuurnb
dependentk(i)=true; ~ 0 C
if k=I then declare
that Pi is deadlocked
else for all Pm and Pn such that u i docinu Va
Pk is locally dependent upon Pm, and e
Pm is waiting on Pn and
Pm and Pn are on different sites,
send probe(I,m.n) to the home sites of Pn
end
olead
lock dsleelf
S1 hl
P8 ab QP4
P100
PS
$3 P7
$2
Public 3
Private 3 1 Public 2 => 3
Private 2
Fig. 3.11.2
TECHNICAL PUBLICATIONS-
An up thrust for
knowledge
3- 23 Distributed Mutex and Deadlock
ADrocess determines if it is deadlocked by initiating áojRaA
DistributedSystems
diffusion computation.
3.11.3
Diffusion Computation based Algorithm
Two types of messages used for this are the quefy (i, j, k) and the reply (l, j, k)
messages. exotto
A
A blocked process initiates deadlock detection by sending query messages to all
theprocesses from whom it is waiting to receive a message (dependent set).
°Fexe
Active
Upon receiving the first query message inthated by P, the blocked process P
propagates the query to all the processes in its dependent set and sets a local
variable num,(i) to the number of query messages sent.
If the query message is not the first one received by Py initiated by P, it replies toit
it if it has been continuously been blocked since the first query. Otherwise,
discards the query.
A
The process Py will finally send a reply message to Pi when it has received a reply
B
for every query message that it sent. For every replý, Pg will decrement num^(i)
and when num,1)=0, it sends a reply to P
. An initiator-detects a deadlock when it receives reply messages to all the query