Sobes.tech
Junior — Middle

What is the minimum number of mutexes needed to cause a deadlock?

sobes.tech AI

Answer from AI

The minimum number of mutexes for a deadlock to occur is two.

A classic example:

  • Thread A acquires mutex 1 and tries to acquire mutex 2.
  • Thread B acquires mutex 2 and tries to acquire mutex 1.

Both threads are waiting for the mutex held by the other thread, leading to a deadlock.