Name:
Time: 2hrs 40min. Total points are 148.
A.
Serializability I (8)
Consider the following schedule S, consisting of transactions T1, T2 and T3
T1
T2
T3
w(A) r(A) w(B) w(B) w(B) w(A) r(B) r(B) • Give the precedence graph for S
• Is S conflict serializable ? Justify your answer.
• Is S view serializable ? Justify your answer.
.Solution
T1
T3
T1
T2
•
•
Precedence Graph
S is not conflict serializable because there is a circle T1- T3- T1
S is view serializable because there is the following serial schedule S’ where all reads of S and S’ read the same value and all writes write the same value.
T1
T2
T3
w(A) w(B) r(A) w(A) r(B) w(B) w(B) r(B) •
B.
Serializability II (15)
Two transactions are not interleaved in a schedule S if every operation of one transaction precedes every operation of the other. (Note, the schedule may not be serial.) Give an example of a serializable schedule S that has all of the following properties:
• transactions T1 and T2 are not interleaved in S
• T1 starts before T2 in S
• in any serial schedule equivalent to S, T2 precedes T1
Hint: The schedule may include more than two transactions.
.Solution
Consider the following schedule S
T1
T2
T3
w(A) r(A) r(B) w(B) S is serializable (acyclic precedence graph), T1 and T2 are not interleaved in S and T1 starts before
T2. In every serial schedule S’ equivalent to S T3 precedes T1 because it is impossible to bring r(A) ahead of w(A). Similarly, T2 precedes T3 because it is impossible to bring w(B) ahead of r(B).
Hence, in every serial schedule T2 precedes T1.
C.
Serializability III (15)
Consider two non-identical schedules S and S’ consisting of transactions T1,…, Tn where n>1. For each of the following set of conditions decide whether S and S’
• have to be equivalent,
• have to be nonequivalent,
• is impossible to decide whether they are equivalent or not