For the schedule given below involving transactions T1 and T2, which of the…
1999
For the schedule given below involving transactions T1 and T2, which of the following is correct?
1. T1: Read(A)
2. T2: Read(B)
3. T1: Write(A)
4. T2: Read(A)
5. T2: Write(A)
6. T2: Write(B)
7. T1: Read(B)
8. T1: Write(B)
- A.
The schedule is serializable and can occur under the 2PL protocol.
- B.
The schedule is serializable but cannot occur under the 2PL protocol.
- C.
The schedule is not serializable but can occur under the 2PL protocol.
- D.
The schedule is not serializable and cannot occur under the 2PL protocol.
Attempted by 25 students.
Show answer & explanation
Correct answer: D
The correct answer is: The schedule is not serializable and cannot occur under the 2PL protocol.
Build the precedence graph for T1 and T2.
On data item A:
T1 performs Read(A) and Write(A) before T2 performs Read(A) and Write(A). This creates an edge T1 → T2.
On data item B:
T2 performs Read(B) and Write(B) before T1 performs Read(B) and Write(B). This creates an edge T2 → T1.
The precedence graph has a cycle: T1 → T2 → T1. Hence the schedule is not conflict-serializable.
Every schedule produced by the basic 2PL protocol is conflict-serializable. Since this schedule is not conflict-serializable, it cannot occur under 2PL.