Question

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?

Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2014 answer key

Solution

Construct the precedence (serialization) graph for each schedule and check for directed cycles.

  1. Transactions:

    • T1:r1(X);r1(Z);w1(X);w1(Z)T_1: r_1(X); r_1(Z); w_1(X); w_1(Z)
    • T2:r2(Y);r2(Z);w2(Z)T_2: r_2(Y); r_2(Z); w_2(Z)
    • T3:r3(Y);r3(X);w3(Y)T_3: r_3(Y); r_3(X); w_3(Y)
  2. Precedence Graph for Schedule S1S_1:
    S1=r1(X);r3(Y);r3(X);r2(Y);r2(Z);w3(Y);w2(Z);r1(Z);w1(X);w1(Z)S_1 = r_1(X); r_3(Y); r_3(X); r_2(Y); r_2(Z); w_3(Y); w_2(Z); r_1(Z); w_1(X); w_1(Z)

    • On item XX: r3(X)r_3(X) occurs before w1(X)  ⟹  T3→T1w_1(X) \implies T_3 \to T_1.
    • On item YY: r2(Y)r_2(Y) occurs before w3(Y)  ⟹  T2→T3w_3(Y) \implies T_2 \to T_3.
    • On item ZZ: w2(Z)w_2(Z) occurs before r1(Z)r_1(Z) and w1(Z)  ⟹  T2→T1w_1(Z) \implies T_2 \to T_1.
      The edges are T2→T3T_2 \to T_3, T3→T1T_3 \to T_1, and T2→T1T_2 \to T_1. This directed graph is acyclic (topological ordering: T2,T3,T1T_2, T_3, T_1).
      Hence, S1S_1 is conflict-serializable.
  3. Precedence Graph for Schedule S2S_2:
    S2=r1(X);r3(Y);r2(Y);r3(X);r1(Z);r2(Z);w3(Y);w1(X);w2(Z);w1(Z)S_2 = r_1(X); r_3(Y); r_2(Y); r_3(X); r_1(Z); r_2(Z); w_3(Y); w_1(X); w_2(Z); w_1(Z)

    • On item ZZ:
      • r1(Z)r_1(Z) occurs before w2(Z)  ⟹  T1→T2w_2(Z) \implies T_1 \to T_2.
      • w2(Z)w_2(Z) occurs before w1(Z)  ⟹  T2→T1w_1(Z) \implies T_2 \to T_1.
        This creates a direct 2-cycle: T1→T2→T1T_1 \to T_2 \to T_1.
        Because the precedence graph contains a cycle, S2S_2 is NOT conflict-serializable.
  4. Therefore, only S1S_1 is conflict-serializable (option A).

Final answer

A

Common trap

Missing the conflict between r1(Z) and w2(Z) that creates an edge T1 -> T2 in S2.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2014 Computer Science and Information Technology (CS) Session 3
Question
39 of 65, printed as CS Q.29
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.