Skip to main content

🗓️ 02032025 0116
📎

coffman_conditions

NOTE

Deadlocks occur when all of these four conditions hold simultaneously

ConditionDescription
Mutual ExclusionAt least one resource (e.g., a row lock) is held in a non-sharable way.
Hold and WaitA transaction holds a resource while waiting for another.
No PreemptionA resource cannot be forcibly taken away; it must be released voluntarily.
Circular WaitA closed chain of transactions exists, where each transaction is waiting on a resource held by the next transaction in the cycle.
TIP

Breaking any one of these conditions prevents deadlock

For example:

  • Using lock timeouts helps break "No Preemption."
  • Acquiring locks in a fixed order prevents "Circular Wait."

References

  • ChatGPT