The GATE Grind

GATE Operating System: Concurrency and Synchronization – Previous Year Questions

23 GATE previous year questions on Concurrency and Synchronization (Operating System, Computer Science) with answers and explanations, from every paper.

23 questions worth 41 marks in all (5 1-mark, 18 2-mark). Asked between 2007 and 2026, so you can see how the topic has been tested over time.

  1. GATE 2007 CS Q58 (2 marks, Multiple choice) – Two processes share wants1, wants2, initially false, and use the following construct. Which is TRUE?
  2. GATE 2008 CS Q63 (2 marks, Multiple choice) – Counting semaphore s uses P: decrement s, wait if s<0; V: increment s, wake one waiter if s≤0. Binary primitives Pb, Vb implement it as below. What…
  3. GATE 2009 CS Q33 (2 marks, Multiple choice) – Critical-section entry/exit are implemented with test-and-set; X starts at0. Which statements are TRUE? I. Deadlock-free. II. Starvation-free. III.…
  4. GATE 2015 CS (CS3) Q31 (1 mark, Multiple choice) – Shared varP,varQ start false. These loops deliberately put the critical sections INSIDE the while bodies. Which property holds?
  5. GATE 2010 CS Q33 (1 mark, Multiple choice) – Shared Boolean S1,S2 start with arbitrary values. P1 waits while S1==S2, enters its critical section, then assigns S1=S2. P2 waits while S1!=S2,…
  6. GATE 2010 CS Q55 (2 marks, Multiple choice) – Binary semaphores S0,S1,S2 start at 1,0,0. Concurrent processes execute: How many times is zero printed?
  7. GATE 2013 CS Q44 (2 marks, Multiple choice) – x initially zero is shared by W,X,Y,Z. Each process waits on counting semaphore S=2, reads x, computes and stores its update, signals S and…
  8. GATE 2013 CS Q49 (2 marks, Multiple choice) – X computes a[i]=f(i), then ExitX(R,S), for i=0,…,n−1. Y calls EntryY(R,S), then computes b[i]=g(a[i]), for each i. R,S are binary semaphores initially…
  9. GATE 2012 CS Q42 (2 marks, Multiple choice) – Fetch And Add(L,i) atomically returns old L and increments L by i. Shared unsigned L initially zero means unlocked; nonzero means locked. Assess this…
  10. GATE 2016 CS (CS2) Q58 (2 marks, Multiple choice) – Shared turn starts at zero. Process 0 waits while turn == 1, enters its critical section, then sets turn = 1. Process 1 waits while turn == 0, enters…
  11. GATE 2016 CS (CS2) Q59 (2 marks, Numerical answer) – A nonnegative counting semaphore S uses P (decrement, blocking if unavailable) and V (increment). During execution twenty P and twelve V operations…
  12. GATE 2014 CS (CS2) Q41 (2 marks, Multiple choice) – Producer–consumer uses semaphores n = 0 and s = 1. producer: repeat forever produce(); semWait(s); addToBuffer(); semSignal(s); semSignal(n);…
  13. GATE 2016 CS (CS1) Q60 (2 marks, Multiple choice) – Consider the following proposed solution for the critical section problem. There are n processes: P 0 P n-1. In the code, function `pmax` returns an…
  14. GATE 2015 CS (CS1) Q30 (1 mark, Numerical answer) – The following two functions `P1` and `P2` that share a variable `B` with an initial value of 2 execute concurrently. The number of distinct values…
  15. GATE 2018 CS Q50 (2 marks, Multiple choice) – Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is N. Three semaphores empty, full and mutex…
  16. GATE 2019 CS Q33 (1 mark, Numerical answer) – 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 --- ---…
  17. GATE 2026 CS (CS2) Q51 (2 marks, Multiple select) – Consider three processes P 1, P 2, and P 3 running identical code shown below. A and B are binary semaphores initialized to 1 and 0, respectively. X…
  18. GATE 2024 CS (CS2) Q46 (2 marks, Multiple select) – Consider a multi-threaded program with two threads T1 and T2 sharing semaphores s1 (initialized to 1) and s2 (initialized to 0) and a global variable…
  19. GATE 2024 CS (CS1) Q40 (2 marks, Multiple choice) – Two threads T1 (a=a+1; b=b+1;) and T2 (b=2*b; a=2*a;) update shared variables a and b, initially a=b=1. Each statement is atomic. Which option lists…
  20. GATE 2023 CS Q38 (2 marks, Multiple choice) – Consider the two functions incr and decr shown below. There are 5 threads each invoking incr once, and 3 threads each invoking decr once, on the same…
  21. GATE 2022 CS Q19 (1 mark, Multiple choice) – Consider the following threads, T1, T2, and T3 executing on a single processor, synchronized using three binary semaphore variables, S1, S2, and S3,…
  22. GATE 2021 CS (CS1) Q56 (2 marks, Multiple select) – Consider the following pseudocode, where S is a semaphore initialized to 5 in line#2 and counter is a shared variable initialized to 0 in line#1.…
  23. GATE 2020 CS Q44 (2 marks, Multiple choice) – 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…