Practice Exercises
5
To show deadlock freedom, consider the waits for graph. If there is any
edge from an update transaction
T
j
to another update transaction
T
i
, it is
easy to see that
T
i
locks the root before
T
j
. Similarly if there is an edge
from an update txn
T
j
to any readonly transaction
T
k
, which in turn can
only wait for an update transaction
T
i
, it can be seen that
T
i
must have
locked the root before
T
j
. In other words, an older update transaction
cannot wait (directly or indirectly) on a younger update transaction, and
thus, there can be no cycle in the waits for graph.
15.7
Answer:
The proof is in Kedem and Silberschatz,
“
Controlling Concurrency Using
Locking Protocols,
”
Proc. Annual
IEEE
Symposium on Foundations of
Computer Science, 1979. The proof is quite non-trivial, and you may skip
the details if you wish.
Consider,
•
G
(
V
,
A
) : the directed acyclic graph of the data items.
•
T
0
,
T
1
,
T
2
,
.......
,
T
m
are the participating transactions.
•
E
(
T
i
) is the first vertex locked by transaction
T
i
.
•
H9257
:
V
→
{
1,2,3,
....
}
such that for each
u
,w
∈
V
if
<
u
,w >
∈
A
then
H9257
(
u
)
<
H9257
(
w
)
•
F
(
T
i
,
T
j
) is that
v
∈
L
(
T
i
)
intersectiontext
L
(
T
j
) for which
H9257
(
v
) is minimal
•
For each
e
∈
V
, define a relation
H9275
e
⊆
T
×
T
such that
T
i
H9275
e
T
j
for
e
∈
L
(
T
i
)
intersectiontext
L
(
T
j
) iff
T
i
successfully locked
e
and
T
j
either never
(successfully) locked
e
or locked
e
, only after
T
i
unlocked it.
•
Define also,
T
i
H9275
T
j
= ∃
e
[
T
i
H9275
e
T
j
]
a.
Lemma 1
We first show that, for the given protocol,
If
L
(
T
i
)
intersectiontext
L
(
T
j
)
negationslash=
H9278
then
F
(
T
i
,
T
j
)
∈ {
E
(
T
i
)
,
E
(
T
j
)
}
Assume by contradiction that,
F
(
T
i
,
T
j
)
/
∈ {
E
(
T
i
)
,
E
(
T
j
)
}
But then, by the locking protocol (as both
T
i
and
T
j
) had to lock
more than
half
of the predecessors of
F
(
T
i
,
T
j
) ), it follows that
some predecessor of
F
(
T
i
,
T
j
) is in
L
(
T
i
)
intersectiontext
L
(
T
j
) contradicting the
definition of
F
(
T
i
,
T
j
).
b.
Lemma 2
Now we show that,
T
i
H9275
u
T
j
for all
u
∈
L
(
T
i
)
intersectiontext
L
(
T
j
) iff
T
i
H9275
F
(
T
i
,
T
j
)
T
j
.
If
u
=
F
(
T
i
,
T
j
) then
T
i
H9275
F
(
T
i
,
T
j
)
T
j
. is trivially true. If
u
negationslash=
F
(
T
i
,
T
j
),
then
u
/
∈ {
E
(
T
i
)
,
E
(
T
j
)
}
. It thus follows that some predecessor of
w
of
u
was successfully locked by both
T
i
and
T
j
and this
u
was