Two-phase protocol in database management system is

2021

Two-phase protocol in database management system is

  1. A.

    a concurrency mechanism that is not deadlock free

  2. B.

    a recovery protocol used for restoring a database after a crash

  3. C.

    any update to the system log done in 2 phases

  4. D.

    not effective in database

  5. E.

    Question not attempted

Attempted by 274 students.

Show answer & explanation

Correct answer: A

Concept

The two-phase locking (2PL) protocol is a concurrency-control rule for transactions. A transaction must obtain every lock it will need before it releases any lock, which splits its lifetime into two phases:

  1. Growing phase — the transaction may acquire locks but may not release any.

  2. Shrinking phase — once it releases its first lock, it may only release locks and can acquire no new ones.

Following this two-phase rule guarantees that the resulting schedule is conflict-serializable.

Applying it to the statement

Because 2PL only prescribes the order in which locks are acquired and released, it is a concurrency-control mechanism that runs during normal transaction execution. Its guarantee, though, is serializability, not freedom from deadlock. Two transactions can each hold a lock the other still needs, so a deadlock can arise even when both obey the two-phase rule.

Basic 2PL therefore relies on a separate deadlock-detection (wait-for graph) or prevention (wait-die / wound-wait, lock timeouts) scheme; only the conservative (static) variant, which pre-claims all locks up front, is deadlock free. Hence the two-phase protocol is a concurrency mechanism that is not deadlock free.

Why the other statements fail

  • Restoring a database after a crash is the job of log-based recovery (undo/redo, checkpoints), not of a locking protocol.

  • The 'two phases' are the lock-acquiring and lock-releasing stages on data items, not a two-step way of updating the system log.

  • Two-phase locking is one of the most widely used concurrency-control methods in real database systems, so it is far from ineffective.

Explore the full course: Up Lt Grade Assistant Teacher 2025