Question
Consider the following two phase locking protocol. Suppose a transaction accesses (for read or write operations), a certain set of objects . This is done in the following manner:
Step 1. acquires exclusive locks to in increasing order of their addresses.
Step 2. The required operations are performed.
Step 3. All locks are released.
This protocol will
Official answer and solution
- Official answer
- A
- From
- Official GATE 2016 answer key
Solution
Assess the properties of the locking protocol with respect to conflict serializability and deadlock freedom.
The protocol specifies:
- Step 1: Transaction acquires exclusive locks on objects in increasing order of their addresses.
- Step 2: The required operations are performed.
- Step 3: All locks are released.
- Serializability:
- All locks are acquired before any lock is released (in fact, this is strict conservative 2PL).
- Because every transaction follows a two-phase locking rule (a growing phase where locks are acquired, followed by a shrinking phase where locks are released), the conflict serializability of any schedule under this protocol is guaranteed.
- Deadlock Freedom:
- Deadlock requires four Coffman conditions: Mutual Exclusion, Hold and Wait, No Preemption, and Circular Wait.
- In this protocol, objects are linearly ordered by their memory addresses.
- Every transaction must request exclusive locks strictly according to this global increasing order.
- According to Havender's linear ordering principle, a circular wait condition is mathematically impossible because any cycle would imply an impossible strict inequality in object addresses: .
- Therefore, the protocol guarantees deadlock freedom.
Thus, the protocol guarantees both serializability and deadlock-freedom (Option A).
A
Believing that 2PL always suffers from deadlocks, neglecting that ordering lock acquisitions by address prevents circular wait completely.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2016 Computer Science and Information Technology (CS) Session 1
- Question
- 61 of 65, printed as CS Q.51
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.