retagged by
433 views
2 votes
2 votes

The following five concurrent processes operate on counting semaphore variable $\left ( S \right )$, which is initialized to $0$.

  • P1 : wait$\left ( s \right )$ ;     $cs$ ;     signal$\left ( s \right )$ ;
  • P2 : wait$\left ( s \right )$ ;     $cs$ ;     signal $\left ( s \right )$ ;
  • P3 : wait$\left ( s \right )$ ;     $cs$ ;     signal $\left ( s \right )$ ;
  • P4 : signal$\left ( s \right )$ ;  $cs$ ;     wait $\left ( s \right )$ ;
  • P5 : signal$\left ( s \right )$ ;  $cs$ ;     wait $\left ( s \right )$;


The maximum possible value of $S$ is ______.

retagged by

1 Answer

Best answer
3 votes
3 votes

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.

selected by
Answer:

Related questions

3 votes
3 votes
3 answers
4
Bikram asked Feb 9, 2017
764 views
A radio is available at $\text{₹} 27780/-$ cash price, or three equal annual installments at $15\%$ per annum under $CI$ compounding annually. Each installment amount, ...