Machine-translated by Google. Questions are authored in English.
Top

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

  • 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

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.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.