A deadlock occurs when two or more threads wait indefinitely for resources held by one another.
How a Deadlock Happens
Deadlocks typically occur when multiple threads try to get the same set of locks in different orders.
Thread 1 acquires Lock A, then tries to acquire Lock B.
At the same time, Thread 2 acquires Lock B, then tries to acquire Lock A.
Neither can move forward, freezing both threads permanently.
Loading…