Consider the following partial Schedule \(S\) involving two transactions…

2015

Consider the following partial Schedule \(S\) involving two transactions \(T1\) and \(T2\). Only the \(read \) and the \(write \) operations have been shown. The \(read \) operation on data item \(P\) is denoted by \(read(P)\) and the write operation on data item \(P\) is denoted by write\((P)\).

Suppose that the transaction \(T1\) fails immediately after time instance 9. Which one of the following statements is correct?

  1. A.

    \(T2\) must be aborted and then both \(T1\) and \(T2\) must be re-started to ensure transaction atomicity

  2. B.

    Schedule \(S\) is non-recoverable and cannot ensure transaction atomicity

  3. C.

    Only \(T2\) must be aborted and then re-started to ensure transaction atomicity

  4. D.

    Schedule \(S\) is recoverable and can ensure atomicity and nothing else needs to be done

Attempted by 166 students.

Show answer & explanation

Correct answer: B

Conclusion: Schedule S is non-recoverable and cannot ensure transaction atomicity.

  • T1 writes A at time 2.

  • T2 reads A at time 7, so T2 reads an uncommitted value written by T1.

  • T2 commits at time 8, before T1 commits; T1 later fails at time 9 and would need to be undone.

  • Because T2 already committed after reading T1's uncommitted value, rolling back T1 would leave T2 committed on an invalid value. Hence the schedule is non-recoverable.

Implication: To ensure recoverability you must prevent a transaction from committing if it has read uncommitted data (for example, use strict two-phase locking or enforce commit ordering so writers commit before dependent readers).

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir