Consider the following two phase locking protocol. Suppose a transaction \(T\)…
2016
Consider the following two phase locking protocol. Suppose a transaction \(T\) accesses (for read or write operations), a certain set of objects \(\{O_1,...,O_k\}\). This is done in the following manner:
Step 1. T acquires exclusive locks to \(O_1, . . . , O_k\) 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
Attempted by 109 students.
Show answer & explanation
Correct answer: A
Correct: guarantee serializability and deadlock-freedom
Why this holds:
Deadlock-freedom: Acquiring locks in a single global order (increasing addresses) prevents cycles in the waits-for graph. A transaction holding a lock on a higher-address object will only wait for locks with higher addresses, so circular wait cannot occur.
Serializability: Using exclusive locks and holding them through the operations enforces the locking discipline of two-phase locking. Conflicting operations cannot proceed concurrently because one transaction holds the exclusive lock, so the resulting execution is conflict-serializable.
Caveat: These guarantees assume every transaction follows the protocol (acquire all needed locks in the specified order and release them only after the operations).
A video solution is available for this question — log in and enroll to watch it.