Question

Consider a schedule of transactions T1T_1 and T2T_2 given below.

T1RARCWDWBCommitT2RBWBRDWCCommit\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline T_1 & \text{RA} & & \text{RC} & & \text{WD} & & \text{WB} & \text{Commit} & & \\ \hline T_2 & & \text{RB} & \text{WB} & \text{RD} & & \text{WC} & & & \text{Commit} & \\ \hline \end{array}

Here, RX\text{RX} stands for "Read(X)" and WX\text{WX} stands for "Write(X)". Which one of the following schedules is conflict equivalent to the above schedule?

Choose one option
Official answer and solution
Official answer
A
From
Official GATE 2020 answer key

Solution

List all conflicting pairs of operations in the given schedule and match their order with the options.

Two operations in a schedule are in conflict if they belong to different transactions, access the same data item, and at least one is a write.

In the given schedule:

  • Data item B: T2T_2 performs R(B)R(B) then W(B)W(B). Later, T1T_1 performs W(B)W(B). Conflicting pairs: R2(B)→W1(B)R_2(B) \to W_1(B) and W2(B)→W1(B)W_2(B) \to W_1(B) (order: T2→T1T_2 \to T_1).
  • Data item D: T2T_2 performs R(D)R(D). Later, T1T_1 performs W(D)W(D). Conflicting pair: R2(D)→W1(D)R_2(D) \to W_1(D) (order: T2→T1T_2 \to T_1).
  • Data item C: T1T_1 performs R(C)R(C). Later, T2T_2 performs W(C)W(C). Conflicting pair: R1(C)→W2(C)R_1(C) \to W_2(C) (order: T1→T2T_1 \to T_2).

Examine Option A:

  • T2T_2 executes R(B),W(B),R(D)R(B), W(B), R(D) before T1T_1 executes W(D),W(B)W(D), W(B). Thus, R2(B)→W1(B)R_2(B) \to W_1(B), W2(B)→W1(B)W_2(B) \to W_1(B), and R2(D)→W1(D)R_2(D) \to W_1(D) are all preserved in the direction T2→T1T_2 \to T_1.
  • T1T_1 executes R(C)R(C) before T2T_2 executes W(C)W(C). Thus, R1(C)→W2(C)R_1(C) \to W_2(C) is preserved in the direction T1→T2T_1 \to T_2.
  • Since every conflicting pair is executed in the exact same relative order, Option A is conflict equivalent to the given schedule.
Final answer

A

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2020 Computer Science and Information Technology (CS)
Question
47 of 65, printed as CS Q.37
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.