Question

Consider the following schedule S of transactions T1, T2, T3, T4:

T1 T2 T3 T4
Reads(X)
Writes(X) / Commit
Writes(X) / Commit
Writes(Y) / Reads(Z) / Commit
Reads(X) / Reads(Y) / Commit

Which one of the following statements is CORRECT?

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

Solution

Construct the precedence graph to test for conflict-serializability, and inspect read-write dependencies to check recoverability.

  1. Chronological Sequence of Operations:

    1. T2:Read(X)T_2: \text{Read}(X)
    2. T3:Write(X)T_3: \text{Write}(X)
    3. T3:CommitT_3: \text{Commit}
    4. T1:Write(X)T_1: \text{Write}(X)
    5. T1:CommitT_1: \text{Commit}
    6. T2:Write(Y)T_2: \text{Write}(Y)
    7. T2:Read(Z)T_2: \text{Read}(Z)
    8. T2:CommitT_2: \text{Commit}
    9. T4:Read(X)T_4: \text{Read}(X)
    10. T4:Read(Y)T_4: \text{Read}(Y)
    11. T4:CommitT_4: \text{Commit}
  2. Conflict Serializability (Precedence Graph):

    • Conflict pairs on XX:
      • R2(X)R_2(X) before W3(X)  ⟹  T2→T3W_3(X) \implies T_2 \to T_3.
      • R2(X)R_2(X) before W1(X)  ⟹  T2→T1W_1(X) \implies T_2 \to T_1.
      • W3(X)W_3(X) before W1(X)  ⟹  T3→T1W_1(X) \implies T_3 \to T_1.
      • W1(X)W_1(X) before R4(X)  ⟹  T1→T4R_4(X) \implies T_1 \to T_4.
      • W3(X)W_3(X) before R4(X)  ⟹  T3→T4R_4(X) \implies T_3 \to T_4.
    • Conflict pairs on YY:
      • W2(Y)W_2(Y) before R4(Y)  ⟹  T2→T4R_4(Y) \implies T_2 \to T_4.
    • All directed edges: T2→T3→T1→T4T_2 \to T_3 \to T_1 \to T_4. There are no cycles in the graph, so schedule SS is conflict-serializable (equivalent serial order T2,T3,T1,T4T_2, T_3, T_1, T_4).
  3. Recoverability Check:

    • A schedule is recoverable if every transaction TjT_j that reads data written by TiT_i commits only after TiT_i commits.
    • T4T_4 reads XX written by T1T_1: T1T_1 commits at step 5, and T4T_4 commits at step 11 (T1T_1 commits before T4T_4).
    • T4T_4 reads YY written by T2T_2: T2T_2 commits at step 8, and T4T_4 commits at step 11 (T2T_2 commits before T4T_4).
    • No other dirty reads exist. Hence, schedule SS is recoverable.
  4. Conclusion:
    SS is both conflict-serializable and recoverable, which corresponds to option (C).

Final answer

C

Common trap

Missing the edge between T3 and T1 on Write(X)-Write(X) conflict, or assuming a read after commit makes a schedule non-recoverable.

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 2
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.