At a particular time of computation, the value of a counting semaphore is . Then operations and operations were completed on this semaphore. The resulting value of the semaphore is :
View worked solution
Answer: B
A counting semaphore is an integer variable that is modified by two standard atomic operations: (wait) and (signal).
- operation: Decrements the semaphore value by ().
- operation: Increments the semaphore value by ().
Given:
- Initial value of the semaphore,
- Number of operations =
- Number of operations =
We can calculate the final value of the semaphore as follows:
Thus, the resulting value of the semaphore is , which corresponds to option B.
Free practice · Your answers on this page are not saved.
