1
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:
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?
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?
2
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 respectively3
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:
Here wants1 and wants2 are shared variables, which are initialized to false. Which one of the following statements is TRUE about the above construct?
/* 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 */
}
4
GATE CSE 2006
MCQ (Single Correct Answer)
+2
-0.6
The atomic fetch-and-set x, y instruction unconditionally sets the memory location x to 1 and fetches the old value of x n y without allowing any intervening access to the memory location x. consider the following implementation of P and V functions on a binary semaphore S.
void P (binary_semaphore *s) {
unsigned y;
unsigned *x = &(s->value);
do {
fetch-and-set x, y;
} while (y);
}
void V (binary_semaphore *s) {
S->value = 0;
}
Which one of the following is true? Questions Asked from Synchronization and Concurrency (Marks 2)
Number in Brackets after Paper Indicates No. of Questions
GATE CSE 2024 Set 1 (2)
GATE CSE 2023 (1)
GATE CSE 2021 Set 2 (2)
GATE CSE 2020 (1)
GATE CSE 2013 (2)
GATE CSE 2012 (1)
GATE CSE 2010 (1)
GATE CSE 2009 (1)
GATE CSE 2008 (1)
GATE CSE 2007 (1)
GATE CSE 2006 (3)
GATE CSE 2003 (2)
GATE CSE 2001 (1)
GATE CSE 1997 (1)
GATE CSE 1996 (2)
GATE CSE 1992 (1)
GATE CSE 1990 (1)
GATE CSE 1987 (1)
GATE CSE Subjects
Theory of Computation
Operating Systems
Algorithms
Database Management System
Data Structures
Computer Networks
Software Engineering
Compiler Design
Web Technologies
General Aptitude
Discrete Mathematics
Programming Languages