retagged by
11,819 views
20 votes
20 votes

Consider a schedule of transactions $T_1$ and $T_2$:

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

Here, RX stands for “Read(X)” and WX stands for “Write(X)”. Which one of the following schedules is conflict equivalent to the above schedule?

  1. $\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline T_1 &  & & & RA & RC & WD & WB & & \text{Commit} &  \\ \hline T_2  & RB & WB & RD & & & & & WC &  & \text{Commit} \\ \hline \end{array} \\$
  2. $\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline T_1 & RA & RC &WD &WB & &  &  & & \text{Commit} &  \\ \hline T_2  & &  & & &RB & WB & RD& WC &  & \text{Commit} \\ \hline \end{array} \\$
  3. $\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline T_1 &  RA & RC & WD &  &  &  & WB & & \text{Commit} &  \\ \hline T_2  &  &  & & RB & WB  & RD & & WC &  & \text{Commit} \\ \hline \end{array} \\$
  4. $\begin{array}{|c|c|c|c|c|c|c|c|c|c|c|} \hline T_1 &  & & &  & RA & RC & WD & WB & \text{Commit} &  \\ \hline T_2  & RB & WB & RD & WC & & & &  &  & \text{Commit} \\ \hline \end{array}$
retagged by

5 Answers

Best answer
15 votes
15 votes

If you draw the dependency graph, you'll notice that there is a cycle. Hence Option (D) and Option (B) are straightaway False

Now in Option (C), there is a swapping operation of conflicting operations $W_1(D)$ and $R_2(D)$. Hence it's False as well.

Hence, Option(A) is the answer

selected by
16 votes
16 votes

A schedule $T_1$ is said to be conflict equivalent to another schedule if we can obtain $T2$ from $T1$ by swapping non-conflicting instructions.

$T1$ $RA$     $RC$   $WD$   $WB$ $COMMIT$  
$T2$   $RB$ $WB$   $RD$   $WC$     $COMMIT$

A. let us try to get option $A$ by swapping non-conflicting instructions

$T1$ $RA$     $RC$   $WD$   $WB$ $COMMIT$  
$T2$   $RB$ $WB$   $RD$   $WC$     $COMMIT$

We can swap $RA$ with $RB$

$T1$   $RA$   $RC$   $WD$   $WB$ $COMMIT$  
$T2$ $RB$   $WB$   $RD$   $WC$     $COMMIT$

We can swap $RA$ with $WB$

$T1$     $RA$ $RC$   $WD$   $WB$ $COMMIT$  
$T2$ $RB$ $WB$     $RD$   $WC$     $COMMIT$

We can swap $RC$ with $RD$ 

$T1$     $RA$   $RC$ $WD$   $WB$ $COMMIT$  
$T2$ $RB$ $WB$   $RD$     $WC$     $COMMIT$

We can swap $RA$ with $RD$ 

$T1$       $RA$ $RC$ $WD$   $WB$ $COMMIT$  
$T2$ $RB$ $WB$ $RD$       $WC$     $COMMIT$

 We can swap $WB$ with $WC$ 

$T1$       $RA$ $RC$ $WD$ $WB$   $COMMIT$  
$T2$ $RB$ $WB$ $RD$         $WC$   $COMMIT$

$\therefore$ we have obtained schedule given in $A$ from schedule given in question , hence it is correct answer.


B.

$T1$ $RA$ $RC$ $WD$ $WB$         $COMMIT$  
$T2$         $RB$ $WB$ $RD$ $WC$   $COMMIT$

 In question there was conflict from $R_2B \rightarrow W_1B$ but in this option the conflict is swapped i.e. $W_1B \rightarrow R_2B$

Hence it is incorrect.


C

$T1$ $RA$ $RC$ $WD$       $WB$   $COMMIT$  
$T2$       $RB$ $WB$ $RD$   $WC$   $COMMIT$

 

 In question there was conflict from $R_2D \rightarrow W_1D$ but in this option the conflict is swapped i.e. $W_1D \rightarrow R_2D$

Hence it is incorrect.


D.

$T1$         $RA$ $RC$ $WD$ $WB$ $COMMIT$  
$T2$ $RB$ $WB$ $RD$ $WC$           $COMMIT$

 In question there was conflict from $R_1C \rightarrow W_2C$ but in this option the conflict is swapped i.e. $W_2C \rightarrow R_1C$

Hence it is incorrect.

 

7 votes
7 votes
Two schedules are said to be conflict equivalent if the conflicting actions are similar in both of them

Conflicting condition:  (i) Two operations should be from different transactions

                                                     (ii) one of them must be write

                                                     (iii) both the operation should act on same data item

Here in the schedule given in question conflicting operations are :---

RC1 ---WC2  ,   RD2 ---WD1 ,    RB2 --- WB1 ,   WB2 ----WB1

In option( A) we can see that conflicting operations are similar to that of the schedule given in question. Ans; (A)

In option (B)  for example one of the conflicting operation WD1 --> RD2   Therefore can't be the answer.

In option (C) for example one of the conflicting operation WD1 --> RD2    Therefore can't be the answer.

In option (D) for example one of the conflicting operation WC2 --> RC1    Therefore can't be the answer.
1 votes
1 votes
Ans will be A)

If we draw graph only A) is conflict equivalent to the given question
Answer:

Related questions

23 votes
23 votes
3 answers
3
Arjun asked Feb 12, 2020
13,565 views
Consider a relational database containing the following schemas.$$\overset{\text{Catalogue}} {\begin{array}{|c|c|c|} \hline \underline{\text{sno}} & \underline{\text{pno}...
18 votes
18 votes
3 answers
4
Arjun asked Feb 12, 2020
13,080 views
Which one of the following is used to represent the supporting many-one relationships of a weak entity set in an entity-relationship diagram?Diamonds with double/bold bor...