Skip to content
Official PYQ · 2010

GATE CS 2010 Q42 — Transactions and Concurrency Control

Explain with AI

Consider the following schedule for transactions T1,T2T1, T2 and T3:T3:

T1T2T3Read(X)Read(Y)Read(Y)Write(Y)Write(X)Write(X)Read(X)Write(X)\begin{array}{|c|c|c|}\hline \textbf{T1} & \textbf{T2} & \textbf{T3} \\ \hline \text{Read(X)} & \text{} & \text{} \\ \hline \text{} & \text{Read(Y)} & \text{} \\ \hline \text{} & \text{} & \text{Read(Y)} \\ \hline \text{} & \text{Write(Y)} & \text{} \\ \hline \text{Write(X)} & \text{} & \text{} \\ \hline \text{} & \text{} & \text{Write(X)} \\ \hline \text{} & \text{Read(X)} & \text{} \\ \hline \text{} & \text{Write(X)} & \text{} \\ \hline\end{array}
Which one of the schedules below is the correct serialization of the above?

Choose one option
View worked solution

Answer: A

To find the correct serialization order of the given schedule, we construct its precedence graph by identifying conflicting operations. Two operations conflict if they belong to different transactions, access the same data item, and at least one of them is a Write operation.

Let's analyze the conflicting operations chronologically:

  1. Conflicts on data item YY:
    • T3:Read(Y)T3: \text{Read}(Y) occurs before T2:Write(Y)T2: \text{Write}(Y). This gives the precedence edge: T3→T2T3 \to T2
  2. Conflicts on data item XX:
    • T1:Read(X)T1: \text{Read}(X) occurs before T3:Write(X)T3: \text{Write}(X). This gives: T1→T3T1 \to T3
    • T1:Write(X)T1: \text{Write}(X) occurs before T3:Write(X)T3: \text{Write}(X). This also gives: T1→T3T1 \to T3
    • T3:Write(X)T3: \text{Write}(X) occurs before T2:Read(X)T2: \text{Read}(X). This gives: T3→T2T3 \to T2
    • T3:Write(X)T3: \text{Write}(X) occurs before T2:Write(X)T2: \text{Write}(X). This also gives: T3→T2T3 \to T2

Combining all the precedence constraints, we get the following directed edges in the precedence graph:

  • T1→T3T1 \to T3
  • T3→T2T3 \to T2

Since there are no cycles, the schedule is conflict-serializable. Performing a topological sort on this graph yields the unique serialization order:

T1→T3→T2T1 \to T3 \to T2

Therefore, the correct option is A.

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

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions