Wednesday 3 June 2020

UGC NET Computer Science December 2019 | Question 74

Question 74
A counting semaphore is initialized to 8. 3 wait() operations and 4 signal() operations are applied. Find the current value of semaphore variable.
  1. 1. 9
  2. 2. 4
  3. 3. 1
  4. 4. 4
Answer : 1. 9

Explanation
In counting semaphore, Wait operations will decrease the value and signal operations will increase the value.
Initially counting semaphore value is 8.
3 Wait operations= - 3
4 Signal operation= + 4
= 8 - 3 + 4
= 5 + 4
= 9

So, option 1 is correct answer 

Counting semaphore can take non-negative integer values.
Two standard operations, wait and signal are defined on the semaphore. Entry to the critical section is controlled by the wait operation and exit from a critical region is taken care by signal operation. The wait, signal operations are also called P and V operations. The manipulation of semaphore (S) takes place as following:
  1. The wait command P(S) decrements the semaphore value by 1. If the resulting value becomes negative then P command is delayed until the condition is satisfied.
  2. The V(S) i.e. signals operation increments the semaphore value by 1

    Reference : OS Semaphores

PreviousNext
UGC NET CS December 2019 - Question 73UGC NET CS December 2019 - Question 75

No comments:

Post a Comment

UGC NET Computer Science December 2019 | Question 16

Question 16 In a certain coding language. 'AEIOU' is written as 'TNHDZ'. Using the same coding language. 'BFJPV' wil...

Popular Posts