36,954 views
99 99 votes

Consider the following two phase locking protocol. Suppose a transaction $T$ accesses (for read or write operations), a certain set of objects $\{O_1,\ldots,O_k \}$. This is done in the following manner:

  • $\text{Step 1}$. $T$ acquires exclusive locks to $O_1,\ldots,O_k$ in increasing order of their addresses.
  • $\text{Step 2}$. The required operations are performed .
  • $\text{Step 3}$. All locks are released

This protocol will

  1.  guarantee serializability and  deadlock-freedom 
  2.  guarantee neither serializability nor deadlock-freedom 
  3.  guarantee serializability but not deadlock-freedom  
  4.  guarantee deadlock-freedom but not serializability.

11 Answers

Best answer
143 143 votes

Two Phase Locking protocol is conflict serializable. So this is a modified version of the basic $2PL$ protocol, So serializabilty should be guaranteed.. and we can get a serializable scheduling by ordering based on Lock points(same as in basic $2PL$
)..
Now in Step $1,$ exclusive locks are aquired to $O_1,O_2,O_3$.... in increasing order of addresses..since it is mentioned as exclusive lock, only one transaction can lock the object..
Due to acquiring of locks based on ordering of addresses.. and locks aren't released until the transaction completes its operation.. we can prevent the circular wait condition, and hence making it deadlock free.

So, the answer should be (A) guarantees serializability and deadlock freedom

• edited by
32 32 votes
It is Conservative 2PL Protocol which ensures Deadlock Freedom. Therefore A is the correct answer.
6 6 votes
A is correct option .....
2 2 votes

Answer : (A)

Schedule is Serializable since , it uses 2PL .

For Deadlock :  Here note that transaction acquire lock in increasing order only , there for there is never be scenario such that transaction wanted lock on Oj and holding lock on Oi , such that i > j , hence it is deadlock free(In short , it is free from circular wait) .

1 1 vote
EVEN THOUGH THERE IS MORE THAN ONE LOCKS EITHER EXCLUSIVE OR ANY GROWING LOCKS AND RELESING LOCKS DOES NOT OCCUR  DEADLOCK  SO OPTION A IS CORRECT
1 1 vote
In the question it is given that 2PL is being used .

So no matter what they mention in next few lines of questions we can be absolutely sure of one thing, that is , the schedule generated will be conflict serializable. (REASON: If transactions follow 2PL(or any variation of it may be Strict 2PL , Rigorous 2PL , Conservative 2PL) Conflict serializability is always ensured).

Now about deadlock :      

If any transaction is applying locks on all the database items it may need in future then this makes one thing very clear, that such a transaction will never depend on any other transaction for releasing a lock.

This means there can never be a deadlock

 

Ans A
Answer:
Position:
Show:

Related questions

32 32 votes
3 answers 3 answers
12.4k
12.4k views
Sandeep Singh asked Feb 12, 2016
12,366 views
Which one of the following is NOT a part of the ACID properties of database transactions?AtomicityConsistencyIsolationDeadlock-freedom
105 105 votes
8 answers 8 answers
29.7k
29.7k views
Sandeep Singh asked Feb 12, 2016
29,732 views
A database of research articles in a journal uses the following schema.$\text{(VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, YEAR, PRICE)}$The primary key is '$\text{(VOLUME...
106 106 votes
12 answers 12 answers
36.9k
36.9k views
Akash Kanase asked Feb 12, 2016
36,856 views
Consider the following database schedule with two transactions $T_{1}$ and $T_{2}$.$S= r_{2}\left(X\right); r_{1}\left(X\right); r_{2} \left(Y\right); w_{1} \left(X\right...
66 66 votes
6 answers 6 answers
28.0k
28.0k views
Sandeep Singh asked Feb 12, 2016
28,023 views
Consider the transition diagram of a PDA given below with input alphabet $\Sigma=\{a,b\}$ and stack alphabet $\Gamma = \{X,Z\}$. $Z$ is the initial stack symbol. Let $L$ ...