The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+28 votes
3.6k views

Consider the following transactions with data items P and Q initialized to zero:

$T_1$
read (P);   
read (Q);  
if P = 0 then Q := Q + 1 ;  
write (Q).
$T_2$
read (Q);  
read (P);  
if Q = 0 then P := P + 1 ;  
write (P)

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
asked in Databases by Veteran (369k points)
edited by | 3.6k views
0

@Bikram sir 

wht does it mean non-serial interleaving ?

+5

set2018 

wht does it mean non-serial interleaving ?

Non serial Interleaving means  :

  1. read(P) for T1 is executed before write(P) for T2 and
  2. read(q) for T2 is executed before write(q) for T1.

non-serial schedule is a schedule where the operations of a group of concurrent transactions are interleaved

0

what does option (d) mean a schedule for which a precedence graph cannot be drawn
is this possible? , every schedule has transaction represented as nodes and conflicting operations as edges, can someone explain ? @Bikram / @ Arjun ?

0
how to draw graph for this ?
0
@Arjun Sir,

What will be serial schedule output of both transactions?

If T1 -> T2: Conflict between the last operation of T1 with the first operation of T2.

If T2 -> T1: Conflict between the last operation of T2 with the first operation of T1.

What can we infer from the above statements?
0

Non-serial Interleaving means  :

  1. read(P) for T1 is executed before write(P) for T2 and
  2. read(q) for T2 is executed before write(q) for T1.

How is this derived from the given problem?

0
What is significant of this statement here

P and Q are initialized to zero ?
0

@Bikram sir

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

It means we have to check for every possible non serial interleaving possible over T1 and T2 right ?

4 Answers

+48 votes
Best answer
Answer is (B). Explanation: $T1:r(P),r(Q),w(Q) T2:r(Q),r(P),w(P)$ now, consider any non serial schedule for example, $S:r1(P),r2(Q),r1(Q),r2(P),w1(Q),w2(P)$ now, draw a precedence graph for this schedule. here there is a conflict from $T1->T2$ and there is a conflict from $T2->T1$ therefore, the graph will contain a cycle. so we can say that the schedule is not conflict serializable.
answered by Loyal (8.1k points)
edited by
+2
consider non serial schedule S:r2(Q),r2(P),r1(P),w2(Q),r1(Q),w1(P). this schedule is conflict serizable .
0
is the transactions view serializable also....???
0
Anmol it can be view serializable in some cases but here we're talking about any ( all). In that way option is only (b) .
+4
I think that it's not even view serializable . Here T1 is reading original value of P and T2 is reading original value of Q.

If we consider T1 followed by T2 then T1 will write the value of Q and T2 will not be able to read the original value of Q. Same is the case with T2 followed by T1, T2 will write the value of P and T1 will not be able to read the original value of P

Correct me if I am wrong.
0
@vaishali

your operations are wrong

for example : there is no write on P in transaction 1, but you wrote w1(p) in you schedule

please check it once
0
how to consider any non serial schedule?? Is it randomly choosen??
0
sorry.. not sure now as I am not in touch with database since more than two years. I would suggest to wait for someone's reply or check the reference book..
0

            T1                                                                             T2 

r1(p)  
  r2(q)
  r2(p)
  w2(p)
r1(q)  
w1(q)  
   

here we can clearly see that T1==>T2,  T2==>T1 both conflict pairs are present ,so it's precedence graph will contain cycle ,so not conflict serializable schedule, and there is not any blind-write so there must not be view serializability also.( not CSS + no blind-write ==> no view serializable ,,,, OR ,,,no CSS + view serializable==> atleast one blind-write)

0

@ ,  Is it true for all other non-serial schedule????

0

@MRINMOY_HALDER... yes try for any possibility of non serial schedule...it will not be conflict serializable.

+7 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.
answered by Junior (895 points)
+2 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

answered by Boss (18.9k points)
0

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 votes
option B
answered by Junior (791 points)
0
is this schedule view serializable. i guess its not.
0
how?pls explain
–4
If a schedule has to be view serializable, then it must have blind writes in the transaction, as we see there are no blind writes, it is not view serializable.
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

44,284 questions
49,773 answers
164,284 comments
65,856 users