edited by
14,044 views
53 votes
53 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

edited by

3 Answers

55 votes
55 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)

20 votes
20 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.

6 votes
6 votes
As shown:   T1------>T2            and  T2-------->T1

hence there is a cycle so it is not Conflict Serializable.

For 2PL:  as according to 2PL in the Growing phase we can acquire locks on data items only and in the Shrinking phase we can do unlocking only. Therefore if we do the same as above then in transaction T1 there will be the exclusive lock on data variable A (it can not be unlocked as there is remaining transaction T1) and at the same time if we look at T2, in the T2 transaction it is trying to get a lock on variable A which is not possible.

That’s why it can not occur in the 2PL protocol.

Hence answer is D
Answer:

Related questions

36 votes
36 votes
2 answers
2
35 votes
35 votes
3 answers
3