The following five concurrent processes operate on counting semaphore variable $\left ( S \right )$, which is initialized to $0$.
The maximum possible value of $S$ is ______.
@Utkarsh Joshi
Maximum value of S asked at the end of execution of program or in between ??
The maximum possible value S is 2 (when P4 and P5 enter the critical section) ,
the rest processes decrement S before entering CS and later increments it after completion of CS.
Thus the overall value never goes beyond 2.
64.3k questions
77.9k answers
244k comments
80.0k users