Skip to content
Official PYQ · 2016

GATE CS 2016 Set 2 Q51 — Transactions and Concurrency Control

Explain with AI

Consider the following database schedule with two transactions T1T_{1} and T2T_{2}.

S=r2(X);r1(X);r2(Y);w1(X);r1(Y);w2(X);a1;a2S= r_{2}\left(X\right); r_{1}\left(X\right); r_{2} \left(Y\right); w_{1} \left(X\right); r_{1} \left(Y\right); w_{2} \left(X\right); a_{1}; a_{2}

Where ri(Z)r_{i} (Z) denotes a read operation by transaction TiT_{i} on a variable ZZ, wi(Z)w_{i}(Z) denotes a write operation by TiT_{i} on a variable ZZ and aia_{i} denotes an abort by transaction TiT_{i}.

Which one of the following statements about the above schedule is TRUE?

Choose one option
View worked solution

Answer: C

To determine the correct statement about the schedule SS, let us analyze the dependencies and properties of the transactions:

S=r2(X);r1(X);r2(Y);w1(X);r1(Y);w2(X);a1;a2S = r_{2}(X); r_{1}(X); r_{2}(Y); w_{1}(X); r_{1}(Y); w_{2}(X); a_{1}; a_{2}

1. Checking for Dirty Reads (Cascading Aborts)

A dirty read occurs when a transaction TiT_i reads a data item that has been modified by another active transaction TjT_j (which has not yet committed or aborted).

  • T1T_1 writes to XX (w1(X)w_1(X)). After this, no other transaction reads XX.
  • T2T_2 writes to XX (w2(X)w_2(X)). After this, no other transaction reads XX.
  • There are no other write operations in the schedule.

Since no transaction reads uncommitted data written by another transaction, there are no dirty reads in the schedule. Consequently, the abort of T1T_1 (a1a_1) does not force T2T_2 to abort, and vice-versa. Thus, the schedule is cascadeless (i.e., it does not have cascading aborts).

2. Checking for Recoverability

Since the schedule is cascadeless, it is automatically recoverable. Therefore, Option A is false.

3. Checking for Strictness

A schedule is strict if a transaction can only read or write a data item ZZ after all previous transactions that wrote ZZ have committed or aborted.

  • T1T_1 writes to XX (w1(X)w_1(X)) at step 4.
  • T2T_2 writes to XX (w2(X)w_2(X)) at step 6, before T1T_1 aborts at step 7 (a1a_1).

Since T2T_2 performs a write on XX while T1T_1's write on XX is still uncommitted/unaborted, the schedule is not strict. Therefore, Option D is false.

Conclusion

The schedule is recoverable and does not have cascading aborts. Hence, Option C is the correct statement.

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

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions