Answer :
2 will be the final value of the semaphore.
What is the counting semaphore's initial value?
- The semaphore's value represents the number of resources that are available; a thread can P the semaphore to acquire a resource, utilize it, and then V on the semaphore to return the resource to the pool.
- The sum of the resources that are readily available ought to be the semaphore's starting value.
Initial value of a counting semaphore = 7
totalP() operations performed on the semaphore = 20
totalV() operations performed on the semaphore = 15
Final valoe of semaohore = ?
after 20 P operations performed on the semaphore,
value of the semaphore =
Initial value of a counting semaphore - total P() operations performed on the semaphore
= 7 - 20 = - 13
after 15 V operations performed on the semaphore,
value of the semaphore =
Value of semaphore after 20P operations performed on the semaphore + total V() operations performed on the semaphore
= -13 + 5
= 2
Learn more about semaphore
brainly.com/question/13686147
#SPJ4