Final answer:
The final value of a counting semaphore that started at 7 and then underwent 20 P operations and 15 V operations is 2. This is because P operations decrement and V operations increment the semaphore's value. Option (b) is the correct answer.
Step-by-step explanation:
The question involves understanding the operations on a counting semaphore in operating systems. A semaphore is a synchronization primitive used to manage access to a shared resource in concurrent processes.
Initially, we are given that the semaphore has a value of 7. Then 20 P (wait) operations are performed, followed by 15 V (signal) operations.
A P operation decreases the semaphore's value by one, while a V operation increases it by one. Therefore, after performing 20 P operations, the semaphore's value will decrease by 20, resulting in: 7 - 20 = -13. Next, we perform 15 V operations, increasing the semaphore's value by 15, which gives us: -13 + 15 = 2.
Conclusively, the final value of the semaphore after the 20 P operations and 15 V operations is 2, making option (b) correct.