Backend & systems·Concurrency and coordination
two transactions each hold a lock the other one needs and both sit there until the database kills one of them.
Deadlock
A cycle of processes each waiting on a resource held by another, so none can proceed. Databases detect and abort a victim; in application code it usually just hangs. The standard prevention is a global lock ordering: always acquire in the same sequence, and the cycle cannot form.