2 votes 2 votes At a particular time of computation, the value of a counting semaphore is $7$. Then $20 \ P$ (wait) operations and $15 \ V$ (signal) operations are completed on this semaphore. What is the resulting value of the semaphore? $28$ $12$ $2$ $42$ Operating System ugcnetcse-june2019-paper2 counting-semaphores + – Arjun asked Jul 2, 2019 edited Jul 23, 2019 by Lakshman Bhaiya Arjun 4.0k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes Value of Counting Semaphore = 7 20P and 15V Resulting Value of Semaphore: 7 - 20 + 15 = 2 So, (3) is correct option. Abhisek Tiwari 4 answered Jul 3, 2019 Abhisek Tiwari 4 comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Option(C): 2 Wait(P) decreases the count of counting semaphore and Signal(V) releases the instance i.e,increases the count of semaphore Therefore, 7-20+15=2 Shagun Singh answered Sep 19, 2019 Shagun Singh comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes In terms of Counting semaphore wait/down/$P()$ operartion decrement $(\downarrow)$ the value by $-1$ signal.up/$V()$ operations increment $(\uparrow)$ the value by $+1$ Current value of CS=$7$ Final value after performing $20P$ and $15V$ operations: $(7-20P+15V)=(7-20+15)=+2$ So current value of CS is $2$ Option $(C)$ is correct. Ref:Gate 1992 Hira Thakur answered May 16, 2021 Hira Thakur comment Share Follow See all 0 reply Please log in or register to add a comment.