At a particular time of computation, the value of a counting semaphore is 7. Then 20 p operations and 'x' V operations were completed on this semaphore. If the final value of semaphore is 5. x will be

This question was previously asked in
UGC NET Computer Science (Paper 2) 17 June 2023 Official Paper
View all UGC NET Papers >
  1. 15
  2. 22
  3. 18
  4. 13

Answer (Detailed Solution Below)

Option 3 : 18
Free
UGC NET Paper 1: Held on 21st August 2024 Shift 1
10.8 K Users
50 Questions 100 Marks 60 Mins

Detailed Solution

Download Solution PDF

The correct answer is 18

Key Points

A counting semaphore is a synchronization mechanism used in concurrent programming to control access to a shared resource. It maintains a counter that can be incremented or decremented, allowing a specified number of threads or processes to access the resource simultaneously. The semaphore helps prevent race conditions and ensures orderly access to shared resources in a multithreaded or multiprocess environment.

  • P stands for a wait operation. It reduces the value of counting semaphore by one for each wait operation.
  • V stands for a signal operation. It increases the value of counting semaphore by one for each signal operation.

The current value of counting semaphore is 7. After performing 20P the value of counting semaphore becomes -13. Now 'n' V operations are to be performed, which makes the value of counting semaphore as 5.

The generated equation is like this: \(-13+n=5 => n=5+13 => n=18\)

Latest UGC NET Updates

Last updated on Jun 12, 2025

-> The UGC NET June 2025 exam will be conducted from 25th to 29th June 2025.

-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.

-> The exam is conducted bi-annually - in June and December cycles.

-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions. 

-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.

More Operating System Solution Questions

More Concurrency and Synchronization Questions

Get Free Access Now
Hot Links: teen patti pro teen patti 51 bonus teen patti rummy 51 bonus dhani teen patti