Correct Answer - Option 1 : 18
Concepts:
V(S): signal operation will increment the semaphore variable, that is, S++.
P(S): wait operation will decrement the semaphore variable., that is, S--.
Data:
Initial counting semaphore (I) = 7
Signal operation = x V
Wait operation = 20 P
Final counting semaphore (F) = 5
Calculation:
5 = 7 + x V + 20 P
5 = 7 + x (+1) + 20 (-1)
x = 5 - 7 + 20
∴ x = 18