Operating Systems · Previous year questions
Process Synchronization and Concurrency
23 questions from GATE CS 2011 to 2026, newest first.
Questions
GATE CS 2026 Set 2, Q.51
Consider three processes P1, P2, and P3 running identical code, as shown in the pseudocode below. A and B are two binary semaphores initialized to 1 and 0, respectively. X is a...
Process Synchronization and Concurrency
GATE CS 2024 Set 1, Q.40
Consider the following two threads T1 and T2 that update two shared variables
aandb. Assume that initiallya = b = 1. Though context switching between threads can happen...Process Synchronization and Concurrency
GATE CS 2024 Set 2, Q.46
Consider a multi-threaded program with two threads T1 and T2. The threads share two semaphores:
s1(initialized to 1) ands2(initialized to 0). The threads also share a glo...Process Synchronization and Concurrency · Deadlock Prevention, Avoidance and Detection
GATE CS 2023, Q.38
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); } There are 5 threads each invoking inc...
Process Synchronization and Concurrency
GATE CS 2022, Q.19
Consider the following threads, T1, T2, and T3 executing on a single processor, synchronized using three binary semaphore variables, S1, S2, and S3, operated upon using standard...
Process Synchronization and Concurrency
GATE CS 2021 Set 1, Q.56 (CS Q.46)
Consider the following pseudocode, where is a semaphore initialized to 5 in line#2 and counter is a shared variable initialized to 0 in line#1. Assume that the increment ope...
Process Synchronization and Concurrency
GATE CS 2021 Set 2, Q.52 (CS Q.42)
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2…
Process Synchronization and Concurrency
GATE CS 2020, Q.44 (CS Q.34)
Each of a set of processes executes the following code using two semaphores and initialized to 1 and 0, respectively. Assume that
countis a shared variable initia...Process Synchronization and Concurrency
GATE CS 2019, Q.33 (CS Q.23)
Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100. P1 P2 P3 : : : : : : D = D + 20 D = D -...
Process Synchronization and Concurrency
GATE CS 2019, Q.49 (CS Q.39)
Consider the following snapshot of a system running concurrent processes. Process is holding instances of a resource , . Assume that all instance...
Process Synchronization and Concurrency
GATE CS 2018, Q.50 (CS Q.40)
Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is . Three semaphores empty, full and mutex are defined with respecti...
Process Synchronization and Concurrency
GATE CS 2017 Set 1, Q.27 (CS Q.27)
A multithreaded program executes with number of threads and uses number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks...
Deadlock Prevention, Avoidance and Detection · Process Synchronization and Concurrency
GATE CS 2016 Set 1, Q.60 (CS Q.50)
Consider the following proposed solution for the critical section problem. There are processes: . In the code, function
pmaxreturns an integer not smal...Process Synchronization and Concurrency
GATE CS 2016 Set 2, Q.58 (CS Q.48)
Consider the following two-process synchronization solution. Process 0 -------- Entry: loop while (turn == 1); (critical section) Exit: turn = 1; Process 1 --------- Ent...
Process Synchronization and Concurrency
GATE CS 2016 Set 2, Q.59 (CS Q.49)
Consider a non-negative counting semaphore . The operation decrements , and increments . During an execution, 20 operations and 12 operation...
Process Synchronization and Concurrency
GATE CS 2015 Set 1, Q.19 (CS Q.9)
The following two functions
P1andP2that share a variableBwith an initial value of execute concurrently. P1() { C = B - 1; B = 2 * C; } P2() { D = 2...Process Synchronization and Concurrency
GATE CS 2015 Set 3, Q.20 (CS Q.10)
Two processes X and Y need to access a critical section. Consider the following synchronization construct used by both the processes /* Process X */ while (true) { varP = t...
Process Synchronization and Concurrency
GATE CS 2014 Set 2, Q.41 (CS Q.31)
Consider the procedure below for the Producer-Consumer problem which uses semaphores: semaphore n = 0; semaphore s = 1; void producer() { while(true) { produce(); semWait(s...
Process Synchronization and Concurrency
GATE CS 2013, Q.16 (CS Q.16)
Three concurrent processes X, Y, and Z execute three different code segments that access and update certain shared variables. Process X executes the P operation (i.e., wait) on...
Process Synchronization and Concurrency
GATE CS 2013, Q.34 (CS Q.34)
A shared variable , initialized to zero, is operated on by four concurrent processes as follows. Each of the processes and reads from memory, increme...
Process Synchronization and Concurrency
GATE CS 2013, Q.39 (CS Q.39)
A certain computation generates two arrays and such that for and for . Suppose this computation is decomposed int...
Process Synchronization and Concurrency
GATE CS 2012, Q.32 (CS Q.32)
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 the old value of X. It is use...
Process Synchronization and Concurrency
GATE CS 2011, Q.35 (CS Q.35)
Consider the following table of arrival time and burst time for three processes P0, P1 and P2. Process Arrival time Burst Time P0 0 ms 9 ms P1 1 ms 4 ms P2 2 ms 9 ms The pre-emp...
Process Synchronization and Concurrency