What happens if we increment binary semaphore $x$ when it is equal to $1$. E.g A process executes $V(x)$ when $x==1$; What are the possible cases then-
Process would be blocked till $x$ becomes $0$. The moment $x$ becomes $0$,it is incremented.
Process would be blocked and no present or future changes will be there for $x$. i.e Process assumes as if there was never a $V(x)$.
Other. (If there is please mention).
Same query for $P(x)$ operation as well when $x=0$.
- Actually, Galvin doesn't mention in pseudo code what to do during such condition.
- Better if Someone could provide standard code for $P(x)$ and $V(x)$... Also, $P$ is wait operation whereas $V$ is signal operation.