what is the difference between semaphore and lock code example
Example: Difference between mutex and binary semaphore
A Mutex(acquire(),release()) is different than a semaphore as
it is a locking mechanism while a semaphore(wait(),signal())
is a signalling mechanism.A binary semaphore can be used as
a Mutex but a Mutex can never be used as a semaphore.