Skip to content
Official PYQ · 2014

GATE CS 2014 Set 2 Q29 — Transactions and Concurrency Control

Explain with AI

Consider the following schedule S of transactions T1,T2,T3,T4:T1, T2, T3, T4:
T1T2T3T4Reads(X)Writes(X)CommitWrites(X)CommitWrites(Y) Reads(Z)CommitReads(X)Reads(Y)Commit{\begin{array}{|l|l|l|l|}\hline \textbf{T1}& \textbf{T2}& \textbf{T3}& \textbf{T4} \\ \hline & \text{Reads(X)} \\ && \text{Writes(X)} \\ && \text{Commit} \\ \text{Writes(X)} \\ \text{Commit}& \\ & \text{Writes(Y) } \\ & \text{Reads(Z)} \\ & \text{Commit} \\ &&& \text{Reads(X)} \\ &&& \text{Reads(Y)} \\ & &&\text{Commit} \\ \hline \end{array}}
Which one of the following statements is CORRECT?

Choose one option
View worked solution

Answer: C

To determine the properties of the schedule SS, we analyze it for conflict-serializability and recoverability.

1. Conflict Serializability

We construct the precedence graph by identifying conflicting operations (two operations by different transactions on the same data item, where at least one is a write):

  • R2(X)R_2(X) and W3(X)  ⟹  T2→T3W_3(X) \implies T_2 \to T_3
  • R2(X)R_2(X) and W1(X)  ⟹  T2→T1W_1(X) \implies T_2 \to T_1
  • W3(X)W_3(X) and W1(X)  ⟹  T3→T1W_1(X) \implies T_3 \to T_1
  • W1(X)W_1(X) and R4(X)  ⟹  T1→T4R_4(X) \implies T_1 \to T_4
  • W2(Y)W_2(Y) and R4(Y)  ⟹  T2→T4R_4(Y) \implies T_2 \to T_4

The directed edges in the precedence graph are:

Edges={T2→T3, T2→T1, T3→T1, T1→T4, T2→T4}\text{Edges} = \{T_2 \to T_3,\ T_2 \to T_1,\ T_3 \to T_1,\ T_1 \to T_4,\ T_2 \to T_4\}

Since there are no cycles in this precedence graph, the schedule SS is conflict-serializable. A valid serial order is T2→T3→T1→T4T_2 \to T_3 \to T_1 \to T_4.

2. Recoverability

A schedule is recoverable if, for every transaction TjT_j that reads a data item written by TiT_i, the commit operation of TiT_i occurs before the commit operation of TjT_j (Ci<CjC_i < C_j).

Let's check the read-from relations in SS:

  1. T4T_4 reads XX written by T1T_1:
    • T1T_1 commits before T4T_4 (C1<C4C_1 < C_4). This condition is satisfied.
  2. T4T_4 reads YY written by T2T_2:
    • T2T_2 commits before T4T_4 (C2<C4C_2 < C_4). This condition is satisfied.

Since all read-from dependencies satisfy the commit order requirement, the schedule is recoverable.

Conclusion

The schedule SS is both conflict-serializable and recoverable.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions