Consider the transactions T1, T2, T3 ​and the schedules S1 ​and S2 ​given…

2024

Consider the transactions T1, T2, T3 ​and the schedules S1 ​and S2 ​given below.
T1: r1(x); r1(z); 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); w3(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?

  1. A.

    Only S 1 ​ is conflict-serializable

  2. B.

    Only S 2 ​ is conflict-serializable

  3. C.

    Both S 1 ​ and S 2 ​ are conflict-serializable

  4. D.

    Neither S 1 ​ nor S 2 ​ is conflict-serializable

Attempted by 124 students.

Show answer & explanation

Correct answer: A

Method: build the precedence (conflict) graph. Create a node for each transaction. For every pair of conflicting operations on the same data item where an operation of Ti appears before an operation of Tj in the schedule, add an edge Ti → Tj. The schedule is conflict-serializable iff this graph is acyclic.

Analysis of the first schedule

  • Conflicts on x: a read of x by the transaction that performs r3(x) appears before a write of x by the transaction that later does w1(x), giving an edge from the transaction that did r3(x) to the transaction that did w1(x).

  • Conflicts on y: a read of y by the transaction that performs r2(y) appears before a write of y by the transaction that later does w3(y), giving an edge from the transaction that did r2(y) to the transaction that did w3(y).

Summary for the first schedule: the identified edges produce an acyclic graph (no directed cycles). One valid serial order consistent with these edges is T2 → T3 → T1. Therefore the first schedule is conflict-serializable.

Analysis of the second schedule

  • Conflicts on x: a read of x by the transaction that performs r3(x) occurs before a write of x by the transaction that later does w1(x), giving an edge from the transaction that did r3(x) to the transaction that did w1(x).

  • Conflicts on y: a read of y by the transaction that performs r2(y) occurs before a write of y by the transaction that later does w3(y), giving an edge from the transaction that did r2(y) to the transaction that did w3(y).

  • Conflicts on z: the schedule has a read of z by the transaction that performs r1(z) before a write of z by another transaction that later does w2(z), and that write of z then appears before a subsequent write of z by the transaction that does w1(z). These read/write and write/write orderings produce edges that form a directed cycle among the transactions accessing z (for example, an edge from the transaction that did r1(z) to the one that did w2(z), and an edge back from that transaction to the one that later writes z), which yields a cycle in the precedence graph.

Summary for the second schedule: because the precedence graph contains a directed cycle (caused by the z conflicts combined with other interleavings), the second schedule is not conflict-serializable.

Final conclusion: only the first schedule is conflict-serializable; the second is not.

Note: The given schedules and transaction definitions should be read so that each action is associated with the transaction indicated in the schedule. If any transaction labels in the schedule contradict the transaction definitions, the same precedence-graph method applies after clarifying the labels.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor