这就是我对计数信号量的理解
P1 enters critical state
calls wait()
wait()
{
semaphore--;
if (semaphore<=0)
block;
else
execute the c.s
after execution in c.s calls signal();
}
signal()
{
semaphore++;
If(blocked process exists)
allow first process that is waiting and P1 leaves c.s
}
如果我是正确的,那么告诉我在二进制信号量只能有 1 和 0 作为值的情况下会发生什么。还是二进制信号量的实现与此不同?