Aspire's Library

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

Previous Year Question (PYQs)



A counting semaphore is initialized to $8$. $3$ wait $()$ operations and $4$ signal $()$ operations are applied. Find the current value of the semaphore variable.





Solution

Initial value of semaphore:

$S=8$

Each wait $()$ operation decreases semaphore value by $1$.

After $3$ wait $()$ operations:

$S=8-3=5$

Each signal $()$ operation increases semaphore value by $1$.

After $4$ signal $()$ operations:

$S=5+4=9$



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...