Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given…
2014
Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below
T1: r1(X); r1(Z); w1(X); w1(Z)
T2: r2(Y); r2(Z); w2(Z) T3: r3(Y); r3(X); w3(Y)
S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z)
S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z)
Which one of the following statements about the schedules is TRUE?
- A.
Only S1 is conflict-serializable.
- B.
Only S2 is conflict-serializable.
- C.
Both S1 and S2 are conflict-serializable.
- D.
Neither S1 nor S2 is conflict-serializable.
Attempted by 111 students.
Show answer & explanation
Correct answer: A
Key insight: build the precedence graph (edge Ti -> Tj when Ti has an operation that conflicts with a later operation of Tj on the same data item). If the graph is acyclic the schedule is conflict-serializable.
For S1 the conflict edges are:
T3 -> T1 (T3 reads X before T1 writes X),
T2 -> T3 (T2 reads Y before T3 writes Y),
T2 -> T1 (T2 writes Z before T1 reads/writes Z).
These edges are acyclic, giving the serial order T2, T3, T1. Therefore S1 is conflict-serializable.
For S2 the conflict edges include:
T3 -> T1 (T3 reads X before T1 writes X),
T2 -> T3 (T2 reads Y before T3 writes Y),
T1 -> T2 (T1 reads Z before T2 later writes Z) and T2 -> T1 (T2 writes Z before T1 writes Z).
These edges create a cycle (e.g. T1 -> T2 -> T3 -> T1), so S2 is not conflict-serializable.
Conclusion: only S1 is conflict-serializable.
A video solution is available for this question — log in and enroll to watch it.