The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+24 votes

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

$$\begin{array}{ll} \text{1} & \text{Read A} & \text{} \\  \text{2} & \text{} & \text{Read B} \\   \text{3} & \text{Write A} & \text{} \\  \text{4} & \text{} & \text{Read A} \\ \text{5} & \text{} & \text{Write A} \\ \text{6} & \text{} & \text{Write B} \\ \text{7} & \text{Read B} & \text{} \\ \text{8} & \text{Write B} & \text{} \\\end{array}$$

  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

in Databases by Veteran (52.1k points)
edited by | 3.4k views
quating from namathe " 2pl guarantees serializability but it does not permit all serializable schedule"
stmt - 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 serializable then not 2pl.

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

3 Answers

+21 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)

by Active (3.6k points)
What it means that it cannot occour in a scheme using 2PL protocol?? Plzzz explain.
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.....
If a schedule occurs in 2PL successfully, it is conflict serializable I think.
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.?
growth and shrinking phase of ""             ""?
where are locks here?
That's what i want to say that there is no locks. So can i say directly it is not using 2-phase locking.

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


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

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?
@thor see my updated solution
0 votes

As we can see the precedence graph is creating a cycle. $\implies$ It is not a conflict serializable schedule


Also there is no blind write in the given schedule $\implies$ It is not view serializable (As it is not a conflict serializable schedule. ) $\implies$ It is not serilizable schedule.


Also if a schedule is not serializable then it cannot be 2PL $\implies$ It is not 2PL schedule.

$\therefore$ Option $D.$ is correct answer.

by Boss (17.2k points)
–1 vote
Option D
by (419 points)

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
49,807 questions
54,727 answers
79,845 users