I’m trying to use the first response to this question to help me on an assignment I’m working on. How exactly does a Semaphore with 0 permits work? It doesn’t really seem to make much sense to me. Is it just to create an eternal wait at that semaphore? If that’s the case, how can you ever have a thread ‘get past’ the semaphore while it’s just waiting for a permit that will never be given to it?
Share
Again from The Little Book of Semaphores, §2.2:
So in the author’s pseduocode,
0isn’t the number of permits; it’s the initial value of the semaphore. What does a value of zero mean? It’s explained in the text immediately proceeding listing 2.1:(emphases added)