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:
- . acquires exclusive locks to in increasing order of their addresses.
- . The required operations are performed .
- . All locks are released
This protocol will
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., holds resource and waits for , while holds and waits for ).
- In this protocol, every transaction must acquire locks in a strict, globally defined order (increasing order of their memory/disk addresses: ).
- If all transactions request resources in the same linear order, a cycle in the wait-for graph is mathematically impossible. For example, if holds and waits for , then . For a cycle to exist, we would need a sequence of transactions such that , 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.
