Skip to content
Official PYQ · 2014

GATE CS 2014 Set 3 Q29 — Transactions and Concurrency Control

Explain with AI

Consider the transactions T1,T2, and T3T1, T2, \:\text{and} \:T3 and the schedules S1 and S2S1 \:\text{and} \:S2 given below. 

  • T1:r1(X);r1(Z);w1(X);w1(Z)T1: r1(X); r1(Z); w1(X); w1(Z)
  • T2:r2(Y);r2(Z);w2(Z)T2: r2(Y); r2(Z); w2(Z)
  • T3:r3(Y);r3(X);w3(Y)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)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)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
View worked solution

Answer: A

To determine if the schedules are conflict-serializable, we construct their precedence graphs. An edge Ti→TjT_i \to T_j exists if there are conflicting operations opi(A)op_i(A) and opj(A)op_j(A) (where at least one is a write) such that opi(A)op_i(A) occurs before opj(A)op_j(A).

Analysis of Schedule S1S1:

  • On XX: r3(X)r_3(X) is before w1(X)  ⟹  T3→T1w_1(X) \implies T3 \to T1
  • On YY: r2(Y)r_2(Y) is before w3(Y)  ⟹  T2→T3w_3(Y) \implies T2 \to T3
  • On ZZ: w2(Z)w_2(Z) is before r1(Z)r_1(Z) and w1(Z)  ⟹  T2→T1w_1(Z) \implies T2 \to T1

The precedence graph for S1S1 contains the edges: {T2→T3,  T3→T1,  T2→T1}\{T2 \to T3, \; T3 \to T1, \; T2 \to T1\}. Since there are no cycles, S1S1 is conflict-serializable (with equivalent serial order T2→T3→T1T2 \to T3 \to T1).

Analysis of Schedule S2S2:

  • On YY: r2(Y)r_2(Y) is before w3(Y)  ⟹  T2→T3w_3(Y) \implies T2 \to T3
  • On ZZ: r1(Z)r_1(Z) is before w2(Z)  ⟹  T1→T2w_2(Z) \implies T1 \to T2
  • On ZZ: w2(Z)w_2(Z) is before w1(Z)  ⟹  T2→T1w_1(Z) \implies T2 \to T1

The precedence graph for S2S2 contains the cycle T1→T2→T1T1 \to T2 \to T1. Since it contains a cycle, S2S2 is not conflict-serializable.

Thus, only S1S1 is conflict-serializable.

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

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions