Skip to content
Official PYQ · 2015

GATE CS 2015 Set 3 Q29 — Transactions and Concurrency Control

Explain with AI

Consider the partial Schedule SS involving two transactions T1T1 and T2T2. Only the read\textit{read} and the write\textit{write} operations have been shown. The read\textit{read} operation on data item PP is denoted by read(P)\textit{read(P)} and write\textit{write} operation on data item PP is denoted by write(P)\textit{write(P)}.
Time InstanceTransaction IDT1T21read(A)2write(A)3read(C)4write(C)5read(B)6write(B)7read(A)8commit9read(B)Schedule S\overset{\large{\text{Schedule S}}}{\begin{array}{c|ll} \textbf{Time Instance}& \rlap{\text{Transaction ID}}\\&\textbf{T1}& \textbf{T2} \\ \hline 1& \text{read(A)} \\ 2& \text{write(A)}\\ 3& & \text{read(C)} \\ 4& & \text{write(C)} \\ 5& & \text{read(B)} \\ 6& & \text{write(B)} \\ 7& & \text{read(A)} \\ 8& & \text{commit} \\ 9& \text{read(B)} \\ \end{array}}

Suppose that the transaction T1T1 fails immediately after time instance 9. Which of the following statements is correct?

Choose one option
View worked solution

Answer: B

To determine the correct statement, let us analyze the dependencies and recoverability of the given schedule SS:

  1. Identify the Write-Read Dependency (Dirty Read):
    • At time instance 2, transaction T1T_1 writes to data item AA (write(A)).
    • At time instance 7, transaction T2T_2 reads data item AA (read(A)).
    • Since T2T_2 reads a value of AA written by T1T_1 before T1T_1 has committed, T2T_2 has a dirty read dependency on T1T_1 (T1→T2T_1 \to T_2).
  2. Recoverability Condition:

    A schedule is recoverable if, for every pair of transactions TiT_i and TjT_j such that TjT_j reads a data item previously written by TiT_i, the commit operation of TiT_i appears before the commit operation of TjT_j.

    Commit(T1)<Commit(T2)\text{Commit}(T_1) < \text{Commit}(T_2)
  3. Checking the Schedule:
    • T2T_2 commits at time instance 8.
    • T1T_1 has not committed by time instance 8 (and fails immediately after time instance 9).
    • Since T2T_2 commits before T1T_1, the recoverability condition is violated. Thus, schedule SS is non-recoverable.
  4. Impact of Failure:

    When T1T_1 fails after time instance 9, it must be aborted and rolled back. However, T2T_2 has already committed at time instance 8. By the Durability property of ACID, a committed transaction's effects cannot be undone. Since we cannot abort T2T_2 to undo the dirty read, transaction atomicity cannot be ensured.

Therefore, Schedule SS is non-recoverable and cannot ensure transaction atomicity.

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

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions