Let the cycle without loss of generality be,
T
0
→
T
1
...
→
T
m
−
1
→
T
0
Here, we know that
m
≥
2
k
, as there must be an Update transaction
on each side of a Readonly transaction, otherwise the cycle will not be
formed.
•
k
=
0: In this case each
T
i
is in
Q
X
, so
Q
becomes the original tree
protocol which ensures the serializability and deadlock freedom.
•
k
=
1: Let
T
i
be the unique transaction in
Q
S
. We can replace
T
i
by
T
X
i
. The resulting schedule follows the original tree protocol which
ensures serializability and deadlock freedom.
•
k
>
1: Let
T
i
∧
Q
S
, then
{
T
i
−
1
,
T
i
+
1
}
∈
Q
X
. As,
m
≥
2
k
≥
4,
i
−
1
n=
i
+
1
(modulo
m
). By the assumption of the given protocol’s deFnition,
L
(
T
i
−
1
)
i
L
(
T
i
+
1
)
n=
H
Thus,
T
i
−
1
→
T
i
+
1
or
T
i
+
1
→
T
i
−
1
; in either case, the original cycle
was not minimal (in the Frst case,
T
i
can be deleted from the cycle, in
the second case there is a cycle involving
T
i
−
i
,
T
i
and
T
i
+
1
.
By contradiction, there can be no such cycle, and thus the new protocol
ensures serializability.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentPractice 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 nontrivial, 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 ±rst vertex locked by transaction
T
i
.
•
H
:
V
→
{
1,2,3,.
...
}
such that for each
u
, w
∈
V
if
<
u
, w >
∈
A
then
H
(
u
)
<
H
(
w
)
•
F
(
T
i
,
T
j
) is that
v
∈
L
(
T
i
)
i
L
(
T
j
) for which
H
(
v
) is minimal
•
For each
e
∈
V
, de±ne a relation
h
e
⊆
T
×
T
such that
T
i
h
e
T
j
for
e
∈
L
(
T
i
)
i
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.
•
De±ne also,
T
i
h
T
j
= ∃
e
[
T
i
h
e
T
j
]
a.
Lemma 1
We ±rst show that, for the given protocol,
If
L
(
T
i
)
i
L
(
T
j
)
n=
±
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
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '13
 Dr.Khansari
 TI, Twophase locking

Click to edit the document details