Learn and practice Aptitude questions and answers with explanation for interview, competitive exam (Pariksha Corner )

Wednesday, January 22, 2020

At a particular time of computation, the value of a counting

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 the semaphore is 5, x will be
A13
B15
C18
D22

Answer: 18

Explanation:

P means wait ie S:= S-1;
V means signal i.e S= S+1;

Each P operation will decrease the semaphore value by 1 and V operation increases by 1.
So,
7 -> 20p -> Xv = 5
=>7-20+X=5 
=> X = 18.

Nithin K
answered Dec 7 '2016 at 22:24

All Comments

Post your answers here:

Post

Post your comments here:

Post

Categories