T3 T4
-------------------------------------
X(W) X(Y)
R(W) X(W)
X(X) R(W)
R(X) X(X)
X(Y) R(X)
U(X) U(X)
U(W) U(W)
Y <- W * X Y <- W * X
W(Y) W(Y)
U(Y) U(Y)
T3 does comply with 2PL. All locks are obtained, followed by all unlocks.
T4 also complies with 2PL.
A
/ \
/ \
B C
/ \ / \
D E F G
/ \ / \ / \ / \
H I J K L M N O
Which of the following sequences of locks and unlocks conforms to
tree-locking protocol?
This is OK.
Cannot obtain the lock on C, as the lock on A was already released.
This is fine. The first lock can be placed anywhere in the tree.
Cannot obtain the lock on K after the lock on E is released.
This is OK.
<T1, start> <T2, start> <T1, X, 10, 50> <T2, X, 50, 55> <T1, Y, 5, 35> <T1, commit>
No undo actions are necessary. Only T1 committed, so the redo sequence sets X to 50 and Y to 35.
T2 is uncommitted, so the undo sequence sets X to 50. T1 is committed, so the redo sequence is as above.
<T1, start> <T2, start> <T1, X, 10, 20> <T3, start> <T2, Y, 21, 22> <T4, start> <T1, Z, 5, 33> <T3, Y, 22, 14> <T1, commit> <T4, Z, 33, 100> <CHECKPOINT> <T2, commit> <T4, X, 20, 15>
Since the protocol is deferred, no undo actions are required.
T1 and T2 are committed, but T1 committed before the checkpoint and does not need to be redone. Therefore, the redo action sets Y to 22.
The uncommitted transactions T3 and T4 must be undone. The sequece of undo actions sets X to 20, Z to 33, and Y to 22. The redo actions are as above.
(1) T1 T2
--------------------
R(X)
R(Y)
W(X)
W(Y)
R(X)
W(X)
R(Y)
W(Y)
Conflicts (T1 - T2)
(2) T1 T2
--------------------
R(X)
R(Y)
W(X)
R(X)
W(X)
W(Y)
R(Y)
W(Y)
Conflicts (T1 - T2)
All conflicts have the same direction in both schedules, therefore the schedules are conflict-equivalent.
Since the schedules are conflict-equivalent, they must also be view-equivalent.
Since S2 is conflict-equivalent to S1, a serial schedule, S2 is conflict-serializable. This is also true because there are no cycles in the precedence graph for S2. It must therefore also be view-serializable.
(1) T1 T2
--------------------
R(Y)
W(Z)
W(Z)
R(Y)
W(X)
Conflicts (T1 - T2)
(2) T1 T2
--------------------
R(Y)
W(Z)
R(Y)
W(Z)
W(X)
Conflicts (T1 - T2)
Since the conflicts are not in the same direction in S1 as in S2, the two schedules are not conflict-equivalent.
The two schedules are not view-equivalent:
Since there are no cycles in the precedence graph for S2, it is conflict-serializable and view-serializable.
(1) T1 T2
--------------------
R(X)
W(Y)
W(Z)
R(X)
W(Z)
W(X)
R(Y)
W(Z)
Conflicts (T1 - T2)
(2) T1 T2
--------------------
R(X)
R(X)
W(Z)
W(X)
W(Y)
R(Y)
W(Z)
W(Z)
Conflicts (T1 - T2)
Since the conflicts are not in the same direction in S1 as in S2, the two schedules are not conflict-equivalent.
The two schedules are view-equivalent:
Since there are cycles in the precedence graph for S2, it is not conflict-serializable. Since S2 is view-equivalent to S1, a serial schedule, S2 is view-serializable.
(1) T1 T2 T3
---------------------------------------
R(X)
W(Z)
R(X)
W(Z)
W(X)
W(Y)
R(Y)
W(Z)
Conflicts (T1 - T2)
Conflicts (T2 - T3)
Conflicts (T1 - T3)
(2) T1 T2 T3
---------------------------------------
R(X)
W(Z)
R(X)
W(Z)
W(X)
W(Y)
R(Y)
W(Z)
Conflicts (T1 - T2)
Conflicts (T2 - T3)
Conflicts (T1 - T3)
Since the conflicts are not in the same direction in S1 as in S2, the two schedules are not conflict-equivalent.
The two schedules are view-equivalent:
Since there are cycles in the precedence graph for S2, it is not conflict-serializable. Since S2 is view-equivalent to S1, a serial schedule, S2 is view-serializable.
This document was generated using the LaTeX2HTML translator Version 98.1p1 release (March 2nd, 1998)
Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html -no_navigation -show_section_numbers -split 0 hw4-spr02-answers.tex.
The translation was initiated by Jack Keane on 2002-05-04