GATE CS 2024 Set 1 — Question 46

MSQ+2 / -0MediumConflict SerializabilityTransactions & ConcurrencyDatabases

Databases → Transactions & Concurrency → Conflict Serializability

Last updated

Question

Consider the following read-write schedule SS over three transactions T1,T2T_1, T_2, and T3T_3, where the subscripts in the schedule indicate transaction IDs:S:r1(z);w1(z);r2(x);r3(y);w3(y);r2(y);w2(x);w2(y);S: r_1(z); w_1(z); r_2(x); r_3(y); w_3(y); r_2(y); w_2(x); w_2(y);Which of the following transaction schedules is/are conflict equivalent to SS ?
A.
T1T2T3T_1 T_2 T_3
B.
T1T3T2T_1 T_3 T_2
C.
T3T2T1T_3 T_2 T_1
D.
T3T1T2T_3 T_1 T_2

Correct answer

(B) T₁ T₃ T₂; (C) T₃ T₂ T₁; (D) T₃ T₁ T₂

Solution

To determine which serial schedules are conflict equivalent to SS, we construct the precedence graph (serialization graph).
1. Identify Conflicts:
A conflict exists if two operations belong to different transactions, access the same data item, and at least one of them is a write operation.
  • Data item zz: Accessed only by T1T_1 (r1(z),w1(z)r_1(z), w_1(z)). No conflicts with other transactions.
  • Data item xx: Accessed only by T2T_2 (r2(x),w2(x)r_2(x), w_2(x)). No conflicts with other transactions.
  • Data item yy: Accessed by T3T_3 (r3(y),w3(y)r_3(y), w_3(y)) and T2T_2 (r2(y),w2(y)r_2(y), w_2(y)).
  • w3(y)w_3(y) occurs before r2(y)r_2(y): Conflict T3T2T_3 \to T_2 (Write-Read).
  • w3(y)w_3(y) occurs before w2(y)w_2(y): Conflict T3T2T_3 \to T_2 (Write-Write).
  • r3(y)r_3(y) occurs before w2(y)w_2(y): Conflict T3T2T_3 \to T_2 (Read-Write).
2. Construct Precedence Graph:
  • Nodes: T1,T2,T3T_1, T_2, T_3
  • Edges: T3T2T_3 \to T_2
  • T1T_1 has no incoming or outgoing edges (it is isolated).
3. Determine Valid Serial Schedules:
A serial schedule is conflict equivalent to SS if it is a topological sort of the precedence graph.
  • The constraint is T3T_3 must precede T2T_2.
  • T1T_1 can be placed anywhere relative to T2T_2 and T3T_3.
Possible topological sorts:
1.T1,T3,T2T_1, T_3, T_2 (Option B)
2.T3,T1,T2T_3, T_1, T_2 (Option D)
3.T3,T2,T1T_3, T_2, T_1 (Option C)
4. Check Options:
  • (A) T1T2T3T_1 T_2 T_3: Here T2T_2 precedes T3T_3, which violates T3T2T_3 \to T_2. Incorrect.
  • (B) T1T3T2T_1 T_3 T_2: T3T_3 precedes T2T_2. Correct.
  • (C) T3T2T1T_3 T_2 T_1: T3T_3 precedes T2T_2. Correct.
  • (D) T3T1T2T_3 T_1 T_2: T3T_3 precedes T2T_2. Correct.
Thus, options (B), (C), and (D) are correct.

More questions on Transactions & Concurrency

Practice GATE CS PYQs with adaptive difficulty

Timed practice, skill tracking, and AI explanations — free to start.

Start practicing free