A counting semaphore was initialized to . Then (wait) operations and (signal) 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 accessed through two standard atomic operations: (wait) and (signal).
- Initial value of the semaphore:
- (wait) operation: Decrements the semaphore value by ().
- (signal) operation: Increments the semaphore value by ().
After performing operations and operations, the final value of the semaphore is calculated as:
Thus, the resulting value of the semaphore is 8.
Free practice · Your answers on this page are not saved.
