Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



At a particular time of computation, the value of a counting semaphore is $7$. Then $20$ $P$ wait operations and $15$ $V$ signal operations are completed on this semaphore. What is the resulting value of the semaphore?





Solution

Initial value of semaphore is

$7$

Each $P$ wait operation decreases the semaphore value by $1$.

So, after $20$ $P$ operations:

$7-20=-13$

Each $V$ signal operation increases the semaphore value by $1$.

So, after $15$ $V$ operations:

$-13+15=2$

Therefore, resulting value of semaphore is

$2$



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...