1
GATE CSE 2010
MCQ (Single Correct Answer)
+2
-0.6
The following program consists of 3 concurrent processes and 3 binary semaphores. The semaphores are initialized as S0=1, S1=0, S2=0. GATE CSE 2010 Operating Systems - Synchronization and Concurrency Question 9 English How many times will process P0 print '0'?
A
At least twice
B
Exaclty twice
C
Exactly thrice
D
Exactly once
2
GATE CSE 2009
MCQ (Single Correct Answer)
+2
-0.6
The enter_CS() and leave_CS() functions to implement critical section of a process are realized using test-and-set instruction as follows:
void enter_CS(X) { 
   while test-and-set(X) ; 
} 

void leave_CS(X) { 
  X=0; 
}
In the above solution, X is a memory location associated with the CS and is initialized to 0. Now consider the following statements:

I. The above solution to CS problem is deadlock-free
II. The solution is starvation free.
III. The processes enter CS in FIFO order.
IV More than one process can enter CS at the same time.

Which of the above statements is TRUE?
A
I only
B
I and II
C
II and III
D
IV only
3
GATE CSE 2008
MCQ (Single Correct Answer)
+2
-0.6
The P and V operations on counting semaphores, where s is a counting semaphore, are defined as follows:

P(s): s = s-1; 
if s < 0 then wait; 
V(s) : s = s-1; 
ifs <= 0 then wakeup a process waiting on s;
Assume that Pb and Vb the wait and signal operations on binary semaphores are provided. Two binary semaphores Xb and Yb are used to implement the semaphore operations P(s) and V(s) as follows:

  P(s): Pb (Xb);
        S = s - 1;
        if(s < 0){
          Vb(Xb);
          Pb(Yb);
        }
        Else Vb (Xb);
  V(s): Pb (Xb);
        S = s + 1;
        if(s <= 0) Vb(Yb);
        Vb(Xb);
The initial values of Xb and Yb are respectively
A
0 and 0
B
0 and 1
C
1 and 0
D
1 and 1
4
GATE CSE 2007
MCQ (Single Correct Answer)
+2
-0.6
Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:
 /* P1 */
  while(true){
  want s1=true;
  while(wants2 == true){
  /* Critical Section */
   wants1 = false;
  }
  /* Reminder Section */
 }
 /* P2 */
  while(true){
  want s2=true;
  while(wants1 == true){
  /* Critical Section */
   Wants2 = false;
  }
  /* Reminder Section */
 }
Here wants1 and wants2 are shared variables, which are initialized to false. Which one of the following statements is TRUE about the above construct?
A
It does not ensure the mutual exclusion.
B
It does not ensure bounded waiting.
C
It requires that processes enter the critical section in strict alternation
D
It does not prevent deadlocks, but ensures mutual exclusion
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12