Good posts about Semaphore vs. Mutex
- MUTEX VS. SEMAPHORES – PART 1: SEMAPHORES
- MUTEX VS. SEMAPHORES – PART 2: THE MUTEX
- MUTEX VS. SEMAPHORES – PART 3 (FINAL PART): MUTUAL EXCLUSION PROBLEMS
MUTEX IS NOT THE SAME AS BINARY SEMAPHORES.
Important difference between Mutex and Semaphore.
– Mutex lock is released by the thread which have acquired the lock.
– Semaphore can be released by other threads.
Semaphore is suitable for producer & consumer pattern.