edited by
27,322 views
65 65 votes

Consider the following three schedules of transactions T1, T2 and T3. [Notation: In the following NYO represents the action Y (R for read, W for write) performed by transaction N on object O.]$$\begin{array}{llll}\hline (S1) & 2RA & 2WA & 3RC & 2WB & 3WA & 3WC & 1RA & 1RB & 1WA & 1WB  \\\hline (S2) & 3RC & 2RA & 2WA & 2WB & 3WA & 1RA & 1RB & 1WA & 1WB & 3WC  \\\hline (S3) & 2RA & 3RC & 3WA & 2WA & 2WB & 3WC & 1RA & 1RB & 1WA & 1WB  \\\hline \end{array}$$Which of the following statements is TRUE?

  1. S1, S2 and S3 are all conflict equivalent to each other
  2. No two of S1, S2 and S3 are conflict equivalent to each other
  3. S2 is conflict equivalent to S3, but not to S1
  4. S1 is conflict equivalent to S2, but not to S3

10 Answers

Best answer
44 44 votes

Two schedules are conflict equivalent if we can derive one schedule by swapping the non-conflicting operations of the other schedule.

S1$$\begin{array}{|l|l|l|}\hline T1 & T2 & T3 \\\hline & R(A) &  \\\hline  & W(A) &  \\\hline   &  &  {\color{Blue} {R(C)}} \\\hline & {\color{Blue} {W(B)}} & \\\hline  &  & W(A)  \\\hline &  & W(C) \\\hline R(A) & & \\\hline R(B) & &  \\\hline W(A) & & \\\hline W(B)  \\\hline \end{array}$$Here, we can swap R(C) and W(B) since they are non-conflicting pair (since they are operating on different data items) 

After swapping the schedule will become $T2 \rightarrow T3 \rightarrow  T1$ $$\begin{array}{|l|l|l|}\hline T1 & T2 & T3 \\\hline & R(A) &  \\\hline  & W(A) &  \\\hline  & W(B) & \\\hline &  & R(C) \\\hline  &  & W(A)  \\\hline &  & W(C) \\\hline R(A) & & \\\hline R(B) & &  \\\hline W(A) & & \\\hline W(B)  \\\hline \end{array}$$


 S2$$\begin{array}{|l|l|l|}\hline T1 & T2 & T3 \\\hline   & & {\color{Blue} {R(C)}}  \\\hline  & R(A) &  \\\hline  & W(A) &  \\\hline  & W(B) &  \\\hline & & W(A)  \\\hline R(A) & &  \\\hline R(B) & & \\\hline W(A) & &  \\\hline  W(B) & &   \\\hline & & {\color{Blue} {W(C)}}  \\\hline \end{array}$$ Here, we can swap and write R(C) after performing T2 operations:-  R(A), W(A) and W(B) since each of them form non-conflicting pair with R(C)  (since they are operating on different data items)

Also, we can swap W(C) and can execute it before all the T1 operations as each of the t1 operations are forming non-conflicting pair with W(C) (since they are operating on different data items)

After swapping the schedule will become $T2 \rightarrow T3 \rightarrow  T1$ $$\begin{array}{|l|l|l|}\hline T1 & T2 & T3 \\\hline & R(A) &  \\\hline  & W(A) &  \\\hline  & W(B) & \\\hline &  & R(C) \\\hline  &  & W(A)  \\\hline &  & W(C) \\\hline R(A) & & \\\hline R(B) & &  \\\hline W(A) & & \\\hline W(B)  \\\hline \end{array}$$


S3$$\begin{array}{|l|l|l|}\hline T1 & T2 & T3 \\\hline   & R(A) &  \\\hline  &  &R(C)  \\\hline   & & {\color{Blue} {W(A)}}  \\\hline  & {\color{Blue} {W(A)}} &  \\\hline & W(B) &  \\\hline  & &W(C)  \\\hline R(A) & & \\\hline R(B) & &  \\\hline  W(A) & &   \\\hline W(B) & &  \\\hline \end{array}$$Here, we can't swap the operations and make it as $T2 \rightarrow T3 \rightarrow  T1$ because of the conflicting pairs W(A)and W(A)

$\therefore$ Option $D.$ S1 is conflict equivalent to S2, but not to S3 is the correct answer.

selected by
32 32 votes

Answer: D

Two schedules are conflict equivalent when the precedence graphs are isomorphic.

For S1, edges in precedence graph are: 2->3, 3->1, 2->1.

For S2, edges in precedence graph are: 2->1, 3->1, 2->3.

For S3, edges in precedence graph are: 3->1, 3->2, 2->1.

Hence, S1 is conflict equivalent to S2, but not to S3.

9 9 votes

According to Wiki...Conflict equivalence

The schedules S1 and S2 are said to be conflict-equivalent if the following two conditions are satisfied:

  1. Both schedules S1 and S2 involve the same set of transactions (including ordering of actions within each transaction). //Holds for S1,S2 in our case but not for S3 due to 2RZ operation.
  2. Both schedules have same set of conflicting operations.//Holds for S1 and S2 in our case
In our case Set of Conflicting operation for S1 = S2 = {2RA ->1RA, 2RA-> 3WA, 2WA->1RA, 2WA->3WA , 2WB->1RB, 3WA->1RA}

Both S1 and S2 satisfies above two conditions so S1 is conflict equivalent to S2. (and S3 eliminated earlier) .Hence Option D is Ans.

//Comment plz if I am missing something

4 4 votes

As the order of conflicting operations should be same. But in S3 it is not same as S1 and S2. I am attaching the picture for the reference.

P.S: Please watch the following video for more clarity


 

2 2 votes
in S3 , there is typo , it should be 2RA instead of 2RZ
becoz all action on an objects should be equal
R(A) 2 times    W(A) 3 times
R(B) 1 time    W(B) 2 times
R(C) 1 time     W(C) 1 time
so in S3 it shoould be only 2RA
Now can draw precedence graph of each schedule
S1 and S2 dont hv cycle and arc also same so conflict
equivalent to each other
but S3 hv cycle so not conflict equivalent
so ans should be D only
Answer:
Position:
Show:

Related questions

70 70 votes
10 answers 10 answers
26.1k
26.1k views
Ishrat Jahan asked Oct 29, 2014
26,106 views
Consider the following relational schema:$\text{Student} (\underline{\text{school-id}, \text{sch-roll-no}}, \text{sname}, \text{saddress})$$\text{School} (\underline{\tex...
68 68 votes
7 answers 7 answers
29.0k
29.0k views
Ishrat Jahan asked Oct 29, 2014
28,971 views
Consider the following relational schema:$\text{Student} (\underline{\text{school-id}, \text{sch-roll-no}}, \text{sname}, \text{saddress})$$\text{School} (\underline{\tex...
40 40 votes
7 answers 7 answers
15.2k
15.2k views
Ishrat Jahan asked Oct 28, 2014
15,167 views
Let $R (A, B, C, D, E, P, G)$ be a relational schema in which the following functional depen­dencies are known to hold: $AB \to CD, DE \to P, C \to E, P \to C$ and $B \to...
140 140 votes
5 answers 5 answers
50.9k
50.9k views
Ishrat Jahan asked Oct 28, 2014
50,916 views
Let $R (A, B, C, D)$ be a relational schema with the following functional dependencies :$A → B$, $B → C$, $C → D$ and $D → B$. The decomposition of $R$ into $(A, B), (B, ...