Skip to content
Official PYQ · 2003

GATE CS 2003 Q87 — Transactions and Concurrency Control

Explain with AI

Consider three data items D1,D2,D1, D2, and D3,D3, and the following execution schedule of transactions T1,T2,T1, T2, and T3.T3. In the diagram, R(D)R(D) and W(D)W(D) denote the actions reading and writing the data item DD respectively.
T1T2T3R(D3);R(D2);W(D2);R(D2);R(D3);R(D1);W(D1);W(D2);W(D3);R(D1);R(D2);W(D2);W(D1);\begin{array}{|l|l|l|}\hline \textbf{T1} & \textbf{T2} & \textbf{T3} \\ \hline \text{} & \text{R(D3);} & \text{}\\ \text{} & \text{R(D2);} & \text{} \\ \text{} & \text{W(D2);} & \text{} \\ \text{} & \text{} & \text{R(D2);} \\ \text{} & \text{} & \text{R(D3);} \\ \text{R(D1);} & \text{} & \text{} \\ \text{W(D1);} & \text{} & \text{} \\ \text{} & \text{} & \text{W(D2);} \\ \text{} & \text{} & \text{W(D3);} \\ \text{} & \text{R(D1);} & \text{} \\ \text{R(D2);} & \text{} & \text{} \\ \text{W(D2);} & \text{} & \text{} \\ \text{} & \text{W(D1);} & \text{}\\ \hline \end{array}Which of the following statements is correct?

Choose one option
View worked solution

Answer: D

To determine if the given schedule is serializable, we construct its precedence (dependency) graph. A directed edge Ti→TjT_i \to T_j exists if there is a conflict between an operation in TiT_i and a subsequent operation in TjT_j on the same data item (where at least one of the operations is a write).

1. Identify Conflicting Operations

  • On Data Item D2D2:
    • T2:W(D2)T2: W(D2) occurs before T3:R(D2)T3: R(D2)   ⟹  T2→T3\implies T2 \to T3
    • T3:W(D2)T3: W(D2) occurs before T1:R(D2)T1: R(D2)   ⟹  T3→T1\implies T3 \to T1
  • On Data Item D1D1:
    • T1:W(D1)T1: W(D1) occurs before T2:R(D1)T2: R(D1)   ⟹  T1→T2\implies T1 \to T2
  • On Data Item D3D3:
    • T2:R(D3)T2: R(D3) occurs before T3:W(D3)T3: W(D3)   ⟹  T2→T3\implies T2 \to T3 (already captured)

2. Construct the Precedence Graph

Combining the dependency edges, we get:

T2→T3→T1→T2T2 \to T3 \to T1 \to T2

The precedence graph contains a cycle: T1→T2→T3→T1T1 \to T2 \to T3 \to T1.

Conclusion

Since the precedence graph contains a cycle, the schedule is not conflict serializable. Furthermore, because there are no blind writes (every write is preceded by a read on the same data item by the same transaction), conflict serializability is equivalent to view serializability. Thus, the schedule is not serializable at all.

Therefore, the correct option is D.

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

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions