jargon

Comparison

DeadlockvsRace condition

Deadlock

two transactions each hold a lock the other one needs and both sit there until the database kills one of them.

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.

Full entry →

Race condition

the bug only shows up under load, never in tests, and the outcome depends on which of two threads got there first.

A defect where the result depends on the unpredictable relative timing of concurrent operations. The signature is irreproducibility: it happens once every ten thousand requests and never in a debugger. Most are read-modify-write sequences that need to be atomic and are not.

Full entry →

Related comparisons