

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CSEP 545 Transaction Processing for E-Commerce 1/18/
Assignment 3 1
A transaction is strict two-phase locked if it is two-phase locked and holds all of its locks until after it commits.
A history is strict two-phase locked if it can be augmented with lock and unlock operations such that every transaction in the history is strict two-phase locked.
A history is normally-strict two-phase locked if it can be augmented with lock and unlock operations such that every lock operation immediately precedes the read or write operation that it synchronizes and every transaction in the history is strict two-phase locked. A history is two-phase locked if it can be augmented with lock and unlock operations such that every transaction in the history is two-phase locked.
Notice that in a two-phase locked or strict two-phase locked history, a transaction can execute a lock operation long before the read or write operation that it synchronizes. This is not the case for normally-strict two-phase locked history.
Answer these questions for the histories below. a) Is it normally-strict two-phase locked? If so, add lock operations to demonstrate it. b) If not, is it strict two-phase locked? If so, add lock operations to demonstrate it. c) If not, is it two-phase locked? If so, add lock operations to demonstrate it. d) If not, draw the serialization graph to find out if it is serializable or not.
Histories (differences from H 1 are in bold):
H 1 : r 1 [y] r 1 [x] r 2 [x] w 1 [y] c 1 w 2 [y] c 2
H 2 : r 1 [y] r 1 [x] r 2 [x] w 2 [x] w 1 [y] c 1 w 2 [y] c 2
H 3 : r 1 [y] r 1 [x] r 2 [x] w 1 [y] w 2 [y] c 2 c 1
H 4 : r 1 [y] r 1 [x] r 2 [x] w 2 [x] r 3 [y] w 1 [y] c 1 w 3 [z] c 3 w 2 [y] c 2
Extra credit : Is it possible for a history to be strict two-phase locked but not normally- strict two phase locked? If so, give an example. If not, give a proof.
Consider a data manager that uses two-phase locking. Suppose all transactions are single- threaded sequential programs, so no transaction can have more than one outstanding read or write request that is blocked. Could a transaction be involved in more than one deadlock? Explain your answer.
CSEP 545 Transaction Processing for E-Commerce 1/18/
Assignment 3 2
Suppose each transaction is a sequential program with no internal concurrency (i.e., no multi-threading). Consider the following three transactions:
T 1 = r 1 [x,y] w 1 [x]
T 2 = r 2 [x] w 2 [z]
T 3 = r 3 [z] r 3 [y] w 3 [y]
a) Suppose the data manager is using two-phase locking. Suppose it receives the transactions’ reads and writes in the following sequence (i.e., the operations may execute in a different order than this): H 1 : r 1 [x,y] r 2 [x] w 1 [x] w 2 [z] r 3 [z] r 3 [y] w 3 [y] The transactions also submitted commit operations but the commits are not shown in the above sequence. Add each transaction’s commit operation to the earliest spot in the sequence where the data manager could have received that commit.
H 2 : r 1 [x,y] r 2 [x] w 1 [x] r 3 [z] w 2 [z] r 3 [y] w 3 [y]