How is this situation a deadlock?Specially using 2PL?

Do not quite get it.

1 Like

It is because neither can proceed. They’re waiting on a lock held by the other, and neither will release its lock until it finishes. 2PL won’t help for the problem is in the waiting and not the locking.

just wait. i mean

In 2PL, a deadlock happens when transactions hold locks and wait on each other in a circular chain.

In this case, T1 acquires a lock on resource A and requests B, while T2 already holds B and requests A. Since 2PL does not allow releasing locks before all required locks are acquired (during the growing phase), neither transaction can proceed.

So both transactions are waiting indefinitely:

T1 → waiting for B (held by T2)
T2 → waiting for A (held by T1)

This circular wait condition is exactly what creates a deadlock under Two-Phase Locking.

-Prestige Safety Nets