Skip to content
Official PYQ · 2016

GATE CS 2016 Set 1 Q51 — Transactions and Concurrency Control

Explain with AI

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,\ldots,O_k \}. This is done in the following manner:

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

This protocol will

Choose one option
View worked solution

Answer: A

To determine the properties of the given protocol, let us analyze serializability and deadlock-freedom separately:

1. Serializability

  • Under the Two-Phase Locking (2PL) protocol, a transaction cannot acquire any new locks once it has released any lock. This divides the transaction execution into a growing phase (acquiring locks) and a shrinking phase (releasing locks).
  • In the given protocol:
    • Step 1 is the growing phase where all exclusive locks are acquired.
    • Step 3 is the shrinking phase where all locks are released.
  • Since no lock is acquired after any lock is released, this protocol strictly adheres to the 2PL rules. Therefore, it guarantees conflict serializability.

2. Deadlock-freedom

  • A deadlock occurs when there is a circular wait among transactions (e.g., T1T_1 holds resource R1R_1 and waits for R2R_2, while T2T_2 holds R2R_2 and waits for R1R_1).
  • In this protocol, every transaction must acquire locks in a strict, globally defined order (increasing order of their memory/disk addresses: O1,O2,…,OkO_1, O_2, \ldots, O_k).
  • If all transactions request resources in the same linear order, a cycle in the wait-for graph is mathematically impossible. For example, if T1T_1 holds OiO_i and waits for OjO_j, then i<ji < j. For a cycle to exist, we would need a sequence of transactions such that i1<i2<⋯<i1i_1 < i_2 < \dots < i_1, which is a contradiction.
  • Thus, ordering resource acquisition prevents circular wait, which guarantees deadlock-freedom.

Since the protocol guarantees both serializability and deadlock-freedom, the correct option is A.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Transactions and Concurrency Control questions