GATE - 1998 | OS | A counting semaphore was initialized to 10. Then 6P (wait) operations

GATE - 1998 | OS | A counting semaphore was initialized to 10. Then 6P (wait) operations
Posted on 28-02-2022

GATE - 1998 [Operating System]

Question:

A counting semaphore was initialized to 10. Then 6P (wait) operations and 4V (signal) operations were completed on this semaphore. The resulting value of the semaphore is

A

0

B

8

C

10

D

12

Solution:

Option (B) is Correct.

Let the semaphore be S which is initially 10.


S = 10
Now 6P operations and uv operations were completed on this semaphore.

So final value of S will be
S = 10 - 6 + 4 = 8

Thank You

Download App for Free PDF Download

GovtVacancy.Net Android App: Download

government vacancy govt job sarkari naukri android application google play store https://play.google.com/store/apps/details?id=xyz.appmaker.juptmh