Few of the major difference between mutex and semaphore are
Mutex | Semaphore |
Mutex is a locking mechanism. | Semaphore is a signaling mechanism. |
Mutex is used for solving critical section problems. | Semaphore is used for event notification that is one thread can notify the other about a certain event. |
The thread which acquired the lock can only release the lock. | In semaphore, it can be released by other threads by use of the signal. |
Mutex allows the multiple threads to access a single resource but one at a time. | Semaphore allows multiple threads to access the finite instance of resources. |
Relevant Posts:
- Thread Synchronization
- Critical Section
- Race Condition
- Semaphore
- Mutual Exclusion(Mutex)
- Spin Lock
- Spin Lock Vs Mutex
- Condition Variables
Categories: Operating system (OS)
Leave a Reply