Question:
If a counting semaphore \(S\) is initialized to 10, and then 6 wait (P) operations and 4 signal (V) operations are executed on \(S\), what is the final value of \(S\)?
यदि एक काउंटिंग सेमाफोर \(S\) का प्रारंभिक मान 10 है, और फिर \(S\) पर 6 wait (P) और 4 signal (V) संक्रियाएँ निष्पादित की जाती हैं, तो \(S\) का अंतिम मान क्या होगा?
Options:
- 8
- 12
- 0
- 4
- 8
- 12
- 0
- 4
Correct Answer: a)
Explanation:
Wait (P) operation decrements the semaphore: \(S = S – 1\).
Signal (V) operation increments the semaphore: \(S = S + 1\).
Final value = \(10 – 6 + 4 = \textbf{8}\) (Option a).
Wait ऑपरेशन सेमाफोर को 1 घटाता है तथा Signal ऑपरेशन 1 बढ़ाता है।
अंतिम मान = \(10 – 6 + 4 = \textbf{8}\) (विकल्प a)।