CSEP 545 Transaction Processing for E-Commerce, Winter 2005 University of Washington |
1/18/05
|
Preliminaries
· Read Chapter 6, Sections 1 – 3. (Read the revision of the chapter that was handed out, not the version in the textbook.)
Problems
1.
A transaction is semi-strict two-phase locked if it holds all of
its write locks until after it commits. (Not a standard term. It’s invented for
this assignment.) It is strict two-phase locked if it is semi-strict
two-phase locked and it releases its read locks no earlier than the moment
before it commits. (This is a standard term.) Notice that strict
two-phase locking is what results from the automatic locking approach described
on slide 24 of Chapter 3.
For each transaction in each of the following histories:
a) Is it strict two-phase locked?
b) If not, is it semi-strict two-phase locked? If so, add the lock operations that demonstrate it.
c) If not, is it two-phase locked? If so, add the lock operations that demonstrate it.
d) If not, is it serializable? Draw a serialization graph to demonstrate whether it’s serializable. If so, does it preserves transaction handshakes?
In each history, changes from the previous history are noted in boldface.
i. r1[x,y] r2[y] w2[x] r3[v] w1[v] c2 c1 w3[x] c3
ii. r1[x,y] r2[y] w2[x] c2 r3[v] w1[v] c1 w3[z] c3
iii. r1[x,y] r2[y] w2[x] r3[x] w1[v] c2 c1 w3[z] c3
iv. r1[x,y] r2[y] w2[x] c2 r3[x] w1[v] c1 w3[z] c3
v. r1[x,y] r2[y] w1[v] c1 w2[x] c2 r3[x] w3[z] c3
2.
Suppose each transaction is a sequential program (i.e. with no internal
concurrency).
a) Suppose the database system uses two-phase locking. Could transactions issue the following sequence of operations?: r1[x,y] r2[y] w2[x] c2 r3[v] w1[v] c1 w3[x] c3
b) Reconsider 2(a) assuming the database system uses strict two-phase locking.
c) Now answer the question for the following sequence, again assuming strict two-phase locking: r1[x,y] r2[y] w2[x] r3[v] w1[v] w3[x] c2 c1 c3