Discussion
Consider the following two phase locking protocol. Suppose a transaction \(T\) accesses (for read or write operations), a certain set of objects \(\{O_{1}, \ldots, O_{k}\}\). This is done in the following manner:
Step 1. \(T\) acquires exclusive locks to \(O_{1}, \ldots, O_{k}\) in increasing order of their addresses.
Step 2. The required operations are performed.
Step 3. All locks are released.
This protocol will
Answer: A
The protocol will guarantee serializability and deadlock-freedom.
All locks are acquired before any are released, so the protocol is two-phase locking (in fact conservative, strict 2PL, since everything is released together at the end), and 2PL guarantees conflict serializability.
Every transaction also acquires its locks in the same global order, increasing address. A deadlock needs a cycle of transactions each waiting for a lock another holds, but with a fixed acquisition order a transaction can only wait for a lock on a higher address than any it already holds, so no cycle can form. That gives deadlock-freedom, which rules out the three other options.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development