Which of these can be owned by a thread?
-
Mutex
-
Semaphore
-
Both of the above
-
None of the above
Reveal answer
Fill a bubble to check yourself
A
Correct answer
Explanation
A mutex (mutual exclusion) is owned by the thread that locks it. Only the owning thread can unlock a mutex, which ensures proper synchronization and prevents race conditions. Semaphores are not owned by any specific thread - any thread can signal or wait on a semaphore.
AI explanation
A mutex represents exclusive ownership: the thread that locks it becomes its owner and is the only one allowed to unlock it, and many implementations use that ownership to detect misuse. A semaphore, by contrast, is just a counter that any thread can signal or wait on — there's no concept of a specific owning thread, which is why it doesn't fit the same ownership model as a mutex.