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

For the schedule given below, which of the following is correct:

1 Read A  
2   Read B
3 Write A  
4   Read A
5   Write A
6   Write B
7 Read B  
8 Write B  


 

  1. This schedule is serializable and can occur in a scheme using 2PL protocol

  2. This schedule is serializable but cannot occur in a scheme using 2PL protocol

  3. This schedule is not serializable but can occur in a scheme using 2PL protocol

  4. This schedule is not serializable and cannot occur in a scheme using 2PL protocol

asked in Databases by Veteran (59.4k points)
edited by | 2k views

3 Answers

+21 votes
Best answer

2PL ---> Conflict Serializable Schedule   ( if p then q)
 

Precedence graph of this given schedule is cyclic hence, this shcedule is not CSS hence not allowed by 2PL   ( contra positive)

This schedule is not even serializable because
if   T1->T2   we'll lose Last Updated by T1 on item B
if   T2->T1   we'll lose initial value of A read by T1

Hence (D) is correct choice! 

Why 2PL won't allow this schedule:

answered by Boss (17k points)
edited by
0
Who says lock's are to be put in above order to be in 2PL? they just need to follow growing and shrinking phase.
0
@Vijay

How can we say that a schedule in not in 2PL on the basis of locks?

In the above schedule, there is deadlock but deadlock is possible in 2PL or it is like - Read(A) of transaction 2 cannot execute in given order that's why given schedule is not allowed by 2PL?
+8

For those who didn't get why if not serialzable then not 2pl.?

we must know that if schedule is 2pl(P) then it is  serialzable(Q) too

So,P->Q which is equivalent to its contrapositive parts i.e ~Q->~P

which states that if not serialzable then not 2pl.

In Schedule given we can easily prove that it is not serialzable and hence not occur in 2pl.

+15 votes

If we draw the precedence graph we get a loop,and hence the schedule is not conflict serializable.

There is no blind write too so ,there is no chance that view serializability can occur.

Now 2pl ensures CS.

Since possiblity of CS is ruled out at the onset,so schedule cannot occur in 2PL.

Ans d)

answered by Active (3.5k points)
0
What it means that it cannot occour in a scheme using 2PL protocol?? Plzzz explain.
0
If a schedule occur in 2PL protocol does it mean that...both the transaction should be completed.?

Because here only first transaction can be completed..second will be blocked at READ A.....
0
If a schedule occurs in 2PL successfully, it is conflict serializable I think.
0
For a schedule to be in 2PL, there should be growth and shrinking phase. Cann't I use this fact to say it is not possible using 2PL.?
0
growth and shrinking phase of ""             ""?
0
locks..
0
where are locks here?
0
That's what i want to say that there is no locks. So can i say directly it is not using 2-phase locking.
+2

if there is a lock then only we can talk about that concept else have to go with other methods to check...

+2

@thor 
we have to put locks ourselves and then check if 2PL is possible or not.
 

0
Suppose if I get some new question regarding if schedule is 2PL or not? then do i have to put locks myself or analyse schedule on the basis of already present lock?
0
@thor see my updated solution
–1 vote
Option D
answered by (421 points)


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

35,506 questions
42,827 answers
121,678 comments
42,181 users