624 views
0 votes
0 votes
What is the actual difference between binary semaphore & Mutex????? Are both same thing????

What is the up() code for binary semaphore?????

1 Answer

0 votes
0 votes

They are NOT the same thing.

They are used for different purposes!
While both types of semaphores have a full/empty state and use the same API, their usage is very different.

Mutex is for exclusive access to a resource(data structure, file, etc..).

 A Binary semaphore should be used for synchronization (i.e. "Hey Someone! This occurred!"). The Binary "giver" simply notifies whoever the "taker" that what they were waiting for happened. 

Related questions

0 votes
0 votes
1 answer
4