Skip to content
Sign in
Computer

What is a deadlock in multithreading?

Tap an option to check the answer. You can also press A–D.

Show answer

Correct answer: B) When threads block each other permanently while waiting for resources

A deadlock occurs when two or more threads wait indefinitely for resources held by each other. None of the threads can proceed, causing the program to freeze. Deadlocks often happen when threads acquire multiple locks in different orders. Proper resource management and lock ordering help prevent deadlocks. Deadlocks are a key concern in multithreading and concurrent programming.
Explanation
A deadlock occurs when two or more threads wait indefinitely for resources held by each other. None of the threads can proceed, causing the program to freeze. Deadlocks often happen when threads acquire multiple locks in different orders. Proper resource management and lock ordering help prevent deadlocks. Deadlocks are a key concern in multithreading and concurrent programming.