rufus v. smith


{ City } wayland
< Country > usa
* Profession * firmware engineer
User No # 49982
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 3
Users Marked my Answers as Wrong # 1
Questions / { rufus v. smith }
Questions Answers Category Views Company eMail




Answers / { rufus v. smith }

Question { Microsoft, 56732 }

What is the difference between mutex and semaphore?


Answer

A semaphore can be claimed a preset number of times, and when this number is reached, additional claims are blocked/denied until there is a release.

A binary semaphore has a count of 1. However, this does NOT make it a mutex.

A mutex is thread-aware. Once claimed, other claims (by other threads) will be blocked/denied. However, the same thread may claim it repeatedly and not be blocked (it must be released the same number of times).

For a binary semaphore, a second claim, even from the same thread, WILL block (not a good situation if from the same thread, make sure to timeout the request)

Is This Answer Correct ?    3 Yes 1 No