SuyashLakhotia/TechInterview

Semaphore vs Mutex

AdityaPai2398 opened this issue Β· 2 comments

Great Collection! πŸ’―

But in https://github.com/SuyashLakhotia/TechInterview/blob/master/5%20-%20OS%20Fundamentals.md#mutexes--semaphores you've mentioned that "They differ only in that a semaphore's integer may start at a number greater than 1."

I don't think it's that accurate because a mutex is locking mechanism used to synchronize access to a resource, while Semaphore is signaling mechanism (β€œI am done, you can carry on” kind of signal).

Source : https://www.geeksforgeeks.org/mutex-vs-semaphore/

Let me know if I'm wrong :)

Good catch! You're right that they mean different things despite the possibility of having similar implementations (i.e. binary semaphore β‰  mutex).

If you'd be kind enough to send a PR, I'll review & merge it ASAP! Else, I'll update it on master soon.

Done!
Please review it.