Timeline for Using a counting semaphore as a binary semaphore
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 21, 2023 at 4:57 | comment | added | 1110101001 | So a binary semaphore just has a max value of 1, and the fact that you do not exceed this is simply an invariant. Note even under the former definition you could imagine a restricted counting semaphore which can take on 0 and 1, i.e. just one waiter. This gives you a signaling primitive, and you can build a wait queue to get back to a traditional binary semaphore (multiple waiters, max value 1), with which you can then build a counting semaphore (can increment beyond 1). | |
Sep 21, 2023 at 4:57 | comment | added | 1110101001 | I think part of the confusion might be that there are 2 equivalent definitions for the wait operation: 1) decrement and if the new value is < 0, wait. 2) Wait until the value > 0, then decrement. The two are equivalent, but with the former your semaphore can take on negative values, while with the latter it does not. This can lead to confusion if you say a binary semaphore has 2 states, when under the former definition it does not seem to (if you have multiple waiters, the value keeps going negative). | |
May 23, 2017 at 12:37 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Oct 15, 2015 at 2:37 | history | tweeted | twitter.com/StackCompSci/status/654486113189556225 | ||
Aug 29, 2015 at 13:55 | vote | accept | Amrith Krishna | ||
Aug 24, 2015 at 23:18 | answer | added | vonbrand | timeline score: 4 | |
Aug 24, 2015 at 12:48 | history | edited | Wandering Logic | CC BY-SA 3.0 |
Make the question conceptual (as opposed to implementation issue.)
|
Aug 23, 2015 at 9:01 | history | edited | Raphael |
edited tags
|
|
Aug 23, 2015 at 5:30 | history | asked | Amrith Krishna | CC BY-SA 3.0 |