這是我的理解有關計數信號我對信號量的邏輯是否正確?
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的二進制值信號的情況下會發生什麼。或者二進制信號量的實現與此不同?