in Databases edited by
22,597 views
70 votes
70 votes

Consider the following transactions with data items $P$ and $Q$ initialized to zero:
$${\begin{array}{|c|l|r|c|}\hline
   \textbf{$T_1$}&    \text{read (P);}\\ & \text{read (Q);} \\ & \text{if P = 0 then Q := Q + 1; }\\ &      \text{write (Q)}  \\ \hline   
\textbf{$T_2$}& \text{read (Q);}\\& \text{read (P);} \\ & \text{if Q = 0 then P := P + 1;}   \\ & \text{write (P)} \\     \hline
\end{array}}$$

Any non-serial interleaving of T1 and T2 for concurrent execution leads to

  1. a serializable schedule
  2. a schedule that is not conflict serializable
  3. a conflict serializable schedule
  4. a schedule for which a precedence graph cannot be drawn
in Databases edited by
by
22.6k views

4 Comments

Just write the transaction as T1 -> T2 and T2 -> T1. You will notice that the no movement of instruction is possible as the first instruction at point of intersection itself is conflicting.
0
0
it wont be VS also right bcoz of no blind write?
0
0
As it is non serial interleaving so if u arrange then total 2 serial arrangements possible and 4 non serial arrangements possible and if u try to draw graph in all those 4 non serial arrangements u get cycle so thats why this schedule is not conflict serializable
0
0

7 Answers

82 votes
82 votes
Best answer
Answer is (B).

Explanation: $T_1:r(P),r(Q),w(Q) T_2:r(Q),r(P),w(P).$

Now, consider any non serial schedule for example, $S:r_1(P),r_2(Q),r_1(Q),r2(P),w_1(Q),w_2(P).$

Now, draw a precedence graph for this schedule. Here there is a conflict from $T_1\to T_2$ and there is a conflict from $T_2\to T_1.$ Therefore, the graph will contain a cycle. So we can say that the schedule is not conflict serializable.
edited by

4 Comments

Oh, I got it . Thanks
Here we have to think with conflict serializable perspective.
What I taught was  a schedule for which a precedence graph cannot be drawn means no sequence 
exist even for view serializable, because any  non-serial interleaving  schedule is not serializable in this 
case.

0
0

here directly we can say that schedule is not view serializable also because it has no any blind write...

1
1

Observe 1st and last operation of T1 and T2; they are arranged in a such way that whatever non serial schedule you take, you can’t swap the non conflicting pairs. Only two serial schedules possible T1→ T2 and T2 → T1.

0
0
24 votes
24 votes

I found this way much simpler : 

 

3 Comments

Why Option D is wrong.
this schedule is not even View serializable doesn't option b is partially wrong.

As it is not conflict serializable it can be view serializable but option d clearly say there is no way we
can make a precedence graph for non-serial execution
2
2

@scholaraniket option d is wrong because we can create a precedence graph with a cycle which contradicts option d.

2
2

@Abhrajyoti00 bro can u plz explain me the solution for this problem that what exactly they are asking and how can we proceed in this ?

0
0
9 votes
9 votes
Answer is b:

As for any non serial interleaving it is necessary that read(p) for t1 is executed before write(p) for t2 and read(q) for t2 is executed before write(q) for t1.This will give you a cycle of length 2 in the precedence graph.
6 votes
6 votes

P and Q are initialised to 0.

Consider the values of P and Q when T1 is executed followed by T2.

P=0 and Q=1

$T_2\rightarrow T_1$

P=1, Q=0

Consider another schedule

T1      T2
R(P)
R(Q)
        R(Q)
        R(P)
        if(Q=0),P=P+1
        W(P)
if (P=0), Q=Q+1
W(Q)

This execution would set values of P and Q both to 1.

As you can see, here consistency requirement the ACID property is broken. Consistency in results is not ensured.

Hence, any non-serial interleaving would never lead to a serial schedule.

Transactions T1 and T2 are inconsistent.

Answer-B

3 Comments

here in question it is asking about the ANY so try to take an counter example and try falsify the each statement

A:Can we make non serializable schdule out of give then schedule 

 see S:r1(P),r2(Q),r1(Q),r2(P),w1(Q),w2(P)S:r1(P),r2(Q),r1(Q),r2(P),w1(Q),w2(P) 

C Again false using same example of option a

D:We can draw precedence graph of any schedule  so false 

so OPTION B is correct

 

0
0

How can we draw precedence graph of this, a precedence graph can be drawn only if it is Conflict serializable, but here on drawing precedence graph, we will get deadlock state. Hence not possible. Please correct me if I'm wrong! (Please tell why option D is FALSE)

0
0
This should be the best answer as it also covers how transactions update values which is not understood by many.
0
0
Answer:

Related questions