Synchronization and Concurrency · Operating Systems · GATE CSE
Start PracticeMarks 1
GATE CSE 2024 Set 1
Which of the following statements about threads is/are TRUE?
GATE CSE 2019
Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100.
The process are ...
GATE CSE 2015 Set 1
A file is organized so that the ordering of data records is the same as or close to the ordering of data entries in some index. Then that index is cal...
GATE CSE 2015 Set 1
The following two functions P1 and P2 that share a variable B with an initial value of 2 execute concurrently.
P1( ) {
C = B – 1;
B = 2 * C;
}
P...
GATE CSE 2013
Three concurrent processes X, Y, and Z execute three different code segments that access and update certain shared variables. Process X executes the P...
GATE CSE 2010
Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared b...
GATE CSE 2002
Which of the following scheduling algorithms is non-preemptive?
GATE CSE 2001
Suppose a processor does not have any stack pointer register. Which of the following statements is true?
GATE CSE 2001
Where does the swap space reside?
GATE CSE 2000
Let m[0] ..m[4] be mutexes (binary semaphores) and P[0] ...P[4] be processes. Suppose each process P[i] executes the following: wait (m[i]); wait (m(m...
GATE CSE 1998
When the result of a computation depends on the speed of the processes involved there is said to be
GATE CSE 1998
A counting semaphore was initialized to 10. Then 6 P (wait) operations and 4 V (signal) operations were completed on this semaphore. The resulting val...
GATE CSE 1996
A critical section is a program segment
Marks 2
GATE CSE 2024 Set 1
Consider the following two threads T1 and T2 that update two shared variables a and b. Assume that initially $a = 1$ and $b = 1$. Though context switc...
GATE CSE 2024 Set 1
Consider the following code snippet using the fork() and wait() system calls. Assume that the code compiles and runs correctly, and that the system ca...
GATE CSE 2023
Consider the two functions incr and decr shown below.
incr() {
wait(s);
X = X+1;
signal(s);
}
decr() {
wait(s);
X = X-1;
signal(s);
...
GATE CSE 2020
Each of a set of n processes executes the following code using two semaphores a and b initialized to 1 and 0, respectively. Assume that count is a sha...
GATE CSE 2013
A shared variable x, initialized to zero, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x fro...
GATE CSE 2013
A certain computation generates two arrays a and b such that a[i]=f(i)for 0 ≤ i < n and b[i] = g (a[i] )for 0 ≤ i < n. Suppose this computation ...
GATE CSE 2012
Fetch_And_Add (X, i) is an atomic Read-Modify-Write instruction that reads the value of memory location X, increments it by the value i, and returns t...
GATE CSE 2010
The following program consists of 3 concurrent processes and 3 binary semaphores. The semaphores are initialized as S0=1, S1=0, S2=0.
How many times...
GATE CSE 2009
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_...
GATE CSE 2008
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) ...
GATE CSE 2007
Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:
/* P1 *...
GATE CSE 2006
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 inte...
GATE CSE 2006
Barrier is a synchronization construct where a set of processes synchronizes globally i.e. each process in the set arrives at the barrier and waits fo...
GATE CSE 2006
Barrier is a synchronization construct where a set of processes synchronizes globally i.e. each process in the set arrives at the barrier and waits fo...
GATE CSE 2003
Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.
Pr...
GATE CSE 2003
Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.
Pr...
GATE CSE 2001
Consider Peterson’s algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below.
Repeat
...
GATE CSE 1997
Each process Pi,i=1.....9 is coded as follows
Repeat
P(mutex){
critical section
}
V(mutex)
Forever
The code for P10 is identical except...
GATE CSE 1996
A solution to the Dining Philosophers Problem which avoids deadlock is
GATE CSE 1996
The concurrent programming constructs fork and join are as below:
Fork (label) which creates a new process executing from the specified label join (v...
GATE CSE 1992
At a particular time of computation the value of a counting semaphore is 7. Then 20 P operations and 15 V operations were completed on this semaphore....
GATE CSE 1990
Semaphore operations are atomic because they are implemented within the OS
GATE CSE 1987
A critical region is: