edited by
1,392 views
0 votes
0 votes
In a certain application, the initial value of a counting semaphore s is 10. The following operations were completed on the semaphore in the given order 5P, 20P, 2V, 18P, 5V, 10P, 1V. The new value of counting semaphore is  _____________ ?
edited by

1 Answer

1 votes
1 votes
Here operation $P$ decreases the value of counting semaphores, and operation $V$ increments the value of counting semaphores.

initial value of counting semaphore =$10$,

new value of CS after performing $5P,20P,2V,18P,5V10P,1V$ operations: $10-5-20+2-18+5-10+1=-35$

Related questions

0 votes
0 votes
1 answer
1
ajayraho asked Oct 23, 2022
918 views
What is the significance of infinite loop that is written in every example of process synchronisation? What would happen if there wasn't any infinite loop?