Semaphores

Question 1

At a particular time of computation, the value of a counting semaphore is 10. Then 12 P operations and “x”  V operations were performed on this semaphore. If the final value of semaphore is 7, x will be :

A
8
B
9
C
10
D
11
       Operating-Systems       Semaphores       UGC-NET JUNE Paper-2
Question 1 Explanation: 
Initial value of counting semaphore is 10. And when a process enters the critical section it decreases the value of counting semaphore using P operation and when a process leaves the critical section it increases the value of counting semaphore using V operation. So, here 12P (subtraction) and x(addition) operation are given. And after performing P(subtraction) and V(addition) the value of counting semaphore is 7.
7 = 10 -12 + x
x = 9
Question 2
Two atomic operations permissible on Semaphores are __________ and __________.
A
wait, stop
B
wait, hold
C
hold, signal
D
wait, signal
       Operating-Systems       Semaphores       UGC NET CS 2017 Nov- paper-2
Question 2 Explanation: 
A semaphore is a variable or abstract data type used to control access to a common resource by multiple processes in a concurrent system such as a multitasking operating system. Two atomic operations are
1. wait: If the value of semaphore variable is not negative, decrement it by 1. If the semaphore variable is now negative, the process executing wait is blocked (i.e., added to the semaphore's queue) until the value is greater or equal to 1. Otherwise, the process continues execution, having used a unit of the resource.
2. signal: Increments the value of semaphore variable by 1. After the increment, if the pre-increment value was negative (meaning there are processes waiting for a resource), it transfers a blocked process from the semaphore's waiting queue to the ready queue.
Question 3
At a particular time of computation, the value of a counting semaphore is 10. Then 12 P operations and “x” V operations were performed on this semaphore. If the final value of semaphore is 7, x will be :
A
8
B
9
C
10
D
11
       Operating-Systems       Semaphores       UGC NET CS 2018 JUNE Paper-2
Question 3 Explanation: 
Initial value of counting semaphore is 10. And when a process enters the critical section it decreases the value of counting semaphore using P operation and when a process leaves the critical section it increases the value of counting semaphore using V operation.
So here 12P (subtraction) and x(addition) operation are given. And after performing P(subtraction) and V(addition) the value of counting semaphore is 7.
7 = 10-12+x
x=9
Question 4
In order to allow only one process to enter its critical section, binary semaphore are initialized to
A
0
B
1
C
2
D
3
       Operating-Systems       Semaphores       UGC NET CS 2010 June-Paper-2
Question 4 Explanation: 
→ In order to allow only one process to enter its critical section, binary semaphore are initialized to 1.
→ It will change its state after enters into critical section. It will be 0.
Question 5
A semaphore count of negative n means (s = – n) that the queue contains ________ waiting processes.
A
n + 1
B
n
C
n – 1
D
0
       Operating-Systems       Semaphores       UGC NET CS 2009 Dec-Paper-2
Question 5 Explanation: 
A semaphore count of negative ‘n’ means (s=-n) that the queue contains ‘n’ waiting processes.
There are 5 questions to complete.
PHP Code Snippets Powered By : XYZScripts.com