The word mutex is really an abbreviation for mutual exclusion; to the mutual exclusion of all other (loser) threads, one thread—the winner—holds (or owns) the mutex lock. Only when it is unlocked can another thread take the lock.
The mutex lock
An FAQ: What really is the difference between the semaphore and the mutex lock? Firstly, the semaphore can be used in two ways—one, as a counter (with the counting semaphore object), and two (relevant to us here), essentially as a mutex lock—the binary semaphore. Between the binary semaphore and the mutex lock, there exists two primary differences: one, the semaphore is meant to be used to synchronize between processes and not the threads internal to a single process (it is indeed a well-known IPC ...
Get Hands-On System Programming with Linux now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.