What is a deadlock in multithreading?

  • AWhen threads finish too quickly
  • BWhen threads block each other permanently while waiting for resources
  • CWhen threads execute sequentially
  • DWhen threads share data safely
Show answerHide answer

Correct answer B

A deadlock occurs when two or more threads wait indefinitely for resources held by each other. None of the threads can procee d, 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.