Skip to content
Official PYQ · 2021

GATE CS 2021 Set 2 Q32 — Transactions and Concurrency Control

Explain with AI

​​​​​Let SS be the following schedule of operations of three transactions T1T_1, T2T_2 and T3T_3 in a relational database system:

R2(Y),R1(X),R3(Z),R1(Y)W1(X),R2(Z),W2(Y),R3(X),W3(Z)R_2(Y), R_1(X), R_3(Z), R_1(Y)W_1(X), R_2(Z), W_2(Y), R_3(X), W_3(Z)

Consider the statements PP and QQ below:

  • PP: SS is conflict-serializable.
  • QQ: If T3T_3 commits before T1T_1 finishes, then SS is recoverable.

Which one of the following choices is correct?

Choose one option
View worked solution

Answer: B

To evaluate the statements, let us analyze the schedule SS step-by-step:

1. Checking Statement PP (Conflict-Serializability):

We identify conflicting operations (different transactions, same data item, at least one write) to construct the precedence graph:

  • On XX: W1(X)W_1(X) occurs before R3(X)R_3(X), which gives the edge T1→T3T_1 \to T_3.
  • On YY: R1(Y)R_1(Y) occurs before W2(Y)W_2(Y), which gives the edge T1→T2T_1 \to T_2.
  • On ZZ: R2(Z)R_2(Z) occurs before W3(Z)W_3(Z), which gives the edge T2→T3T_2 \to T_3.

The precedence graph contains the edges T1→T2T_1 \to T_2, T1→T3T_1 \to T_3, and T2→T3T_2 \to T_3. Since there are no cycles in this graph, the schedule SS is conflict-serializable. Thus, PP is true.

2. Checking Statement QQ (Recoverability):

  • There is a write-read dependency (dirty read) on data item XX because T3T_3 reads XX after it is written by T1T_1 (W1(X)→R3(X)W_1(X) \to R_3(X)).
  • For a schedule to be recoverable, any transaction TjT_j that reads a value written by TiT_i must commit only after TiT_i commits.
  • Therefore, T1T_1 must commit before T3T_3 commits.
  • If T3T_3 commits before T1T_1 finishes, this condition is violated, making the schedule non-recoverable. Thus, QQ is false.

Hence, PP is true and QQ is false.

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

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions