Open In App

GATE | GATE-CS-2016 (Set 1) | Question 61

Like Article
Like
Save
Share
Report

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

Step 1. T acquires exclusive locks to O1, . . . , Ok in increasing order of their addresses.
Step 2. The required operations are performed.
Step 3. All locks are released.

This protocol will
(A) guarantee serializability and deadlock-freedom
(B) guarantee neither serializability nor deadlock-freedom
(C) guarantee serializability but not deadlock-freedom
(D) guarantee deadlock-freedom but not serializability


Answer: (A)

Explanation: The above scenario is Conservative 2PL( or Static 2PL). In Conservative 2PL protocol, a transaction has to lock all the items it access before the transaction begins execution. It is used to avoid deadlocks. Also, 2PL is  conflict serializable, therefore it guarantees serializability.

Therefore option A

Advantages of Conservative 2PL :

  • No possibility of deadlock.
  • Ensure serializability.

Drawbacks of Conservative 2PL :

  • Less throughput and resource utilisation because it holds the resources before the transaction begins execution.
  • Starvation is possible since no restriction on unlock operation.
  • 2pl is a deadlock free protocol but it is difficult to use in practice.


Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads