Question

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

Step 1. TT acquires exclusive locks to O1,…,OkO_1, \dots, O_k in increasing order of their addresses.
Step 2. The required operations are performed.
Step 3. All locks are released.

This protocol will

Choose one option
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:

  1. Step 1: Transaction TT acquires exclusive locks on objects {O1,…,Ok}\{O_1, \dots, O_k\} in increasing order of their addresses.
  2. Step 2: The required operations are performed.
  3. Step 3: All locks are released.
  1. 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.
  1. 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 T1→T2→⋯→Tm→T1T_1 \to T_2 \to \dots \to T_m \to T_1 would imply an impossible strict inequality in object addresses: addr(Oi1)<addr(Oi2)<⋯<addr(Oi1)\text{addr}(O_{i_1}) < \text{addr}(O_{i_2}) < \dots < \text{addr}(O_{i_1}).
  • Therefore, the protocol guarantees deadlock freedom.

Thus, the protocol guarantees both serializability and deadlock-freedom (Option A).

Final answer

A

Common trap

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.