December 7th, 2011, 07:10 AM
Binary semaphore and mutex
What is the main difference between binary semaphore and mutex?
March 20th, 2012, 03:06 PM
This comes from a link (which I can't post yet):
Strictly speaking, a mutex is locking mechanism used to synchronize access to a resource. Only one task (can be a thread or process based on OS abstraction) can acquire the mutex. It means there will be ownership associated with mutex, and only the owner can release the lock (mutex).
Semaphore is signaling mechanism (“I am done, you can carry on” kind of signal). For example, if you are listening songs (assume it as one task) on your mobile and at the same time your friend called you, an interrupt will be triggered upon which an interrupt service routine (ISR) will signal the call processing task to wakeup.
March 16th, 2013, 06:26 PM
both used for synchronization but
semaphore used in child process and mutex is used in thread.
November 4th, 2013, 11:48 AM
Difference between binary semaphore and mutex
* Binary semaphore if the lock is not available, respective process will be stored in its own wait queue but in case of mutex they don't have its own wait queue and it should give the thread to the scheduler and the scheduler will execute the program when the CPU is free or when its turn comes.
* Mutex have ownership (owners can only release the lock) but the semaphores don't have the ownership over the process (if the process is completed the lock will be automatically released).
Please correct me if i am wrong.