Mutex vs Semaphore

The concept of and the differences between a mutex and a semaphore will befuddle most developers. In this lesson, we discuss the differences between the two most fundamental concurrency constructs offered by almost all language frameworks. Difference between a mutex and a semaphore makes a pet interview question for senior engineering positions!

We'll cover the following...

Mutex vs Semaphore

Having laid the foundation of concurrent programming concepts and their associated issues, we'll now discuss the all-important mechanisms of locking and signaling in multi-threaded applications and the differences between these constructs.

Mutex

Mutex as the name hints implies mutual exclusion. A mutex is used to guard shared ...