GateAI

GATE CSE Concurrency and Synchronization PYQs

Medium yield16.7% of Operating Systems

Concurrency and Synchronization is consistently evaluated through rigorous interleaving analysis, semaphore tracing, and correctness verification of mutual excl… Read the guide

Questions
18
Asked
since 2012
Total marks
32
Marks / paper
1.3

18 GATE CSE Concurrency and Synchronization PYQs with solutions, from Operating Systems. Browse all GATE CSE PYQs.

Questions

Every official paper that asked this topic, newest first.

What GATE tests in Concurrency and Synchronization

Concepts, patterns, formulas and traps distilled from past papers.

Concurrency and Synchronization is consistently evaluated through rigorous interleaving analysis, semaphore tracing, and correctness verification of mutual exclusion algorithms. Over the years, GATE tests whether candidates can systematically trace race conditions, identify potential deadlocks from mismatched semaphore wait/signal orders, and compute the bounds or exact sets of possible shared variable values under non-atomic operations. Recent papers heavily favor Multi-Select Questions (MSQs) requiring complete enumeration of all valid execution traces and program outcomes.

Core concepts

  • Mutual Exclusion, Progress, and Bounded Waiting criteria
  • Binary semaphores vs Counting semaphores mechanics
  • Hardware atomic primitives (Fetch-and-Add, Test-and-Set) and spinlocks
  • Barrier synchronization (Turnstile/Rendezvous) using shared counters and semaphores
  • Producer-Consumer bounded-buffer synchronization and semaphore ordering pitfalls
  • Deadlock conditions (Circular Wait, Hold-and-Wait) in multi-semaphore acquisitions
  • Race conditions and non-atomic Read-Modify-Write instructions (LOAD, INCR, STORE)
  • Process address space separation vs Thread shared memory (heap/global) and per-thread private stack
  • Mutual Exclusion requirement
  • Progress requirement (freedom from outside interference)
  • Bounded Waiting requirement
  • Strict Alternation protocol and its limitation
  • Counting semaphore semantics (P/wait decrements, V/signal increments)
  • Permit balance and thread blocking conditions

Recurring question patterns

  • Shared Variable Extremum / Distinct Values Under Interleaving

    Commonmixed2 marks2024, 2023, 2021, 2015

    Threads or processes execute non-atomic read-modify-write sequences (or arithmetic updates) on shared variables under binary or counting semaphores. The candidate must find the maximum/minimum possible final values, the number of distinct outcomes, or enumerate all possible resulting (x, y) tuples.

  • Semaphore-Based Execution Tracing and Possible Output Patterns

    CommonMSQ2 marks2026, 2024, 2022

    Multiple processes or threads coordinate using binary/counting semaphores with specific initial values. Candidates trace the execution order, determine whether specific print/event sequences are possible, or find the correct semaphore initializations required to force a specific recurring sequence.

  • Synchronization Primitive Flaw and Deadlock Analysis

    CommonMCQ2 marks2016, 2015, 2014, 2012

    A synchronization scheme (such as Producer-Consumer, lock-free/hardware primitive like Fetch_And_Add, or custom flag/Bakery algorithm) is provided with subtle flaws. The question asks whether Mutual Exclusion, Progress, Bounded Waiting, or Deadlock-freedom are violated.

  • Synchronization Pattern Recognition (Barrier, Pipeline Handshake, Resource Ordering)

    OccasionalMCQ2 marks2020, 2013

    Snippets implementing classical coordination paradigms (e.g., barrier/rendezvous counters, lockstep producer-consumer handshake, Dijkstra resource hierarchy for deadlock prevention) are evaluated to identify their high-level functionality or correct implementation.

  • Process vs. Thread Memory Isolation with Synchronization

    RareMSQ2 marks2021

    Code involves both multi-processing (fork/independent address spaces) and multi-threading with locks. Tests distinction between thread-shared global variables vs. process-private global memory vs. thread-local stack variables.

  • Critical Section Protocol Requirement Verification

    CommonMCQ2 marks2016

    Given a concurrent pseudocode snippet for two processes sharing control variables (such as a turn or flag variable), determine which of the standard criteria (Mutual Exclusion, Progress, Bounded Waiting) are satisfied or violated.

  • Counting Semaphore Balance and Blocking Bounds

    CommonNAT2 marks2016

    Given a total count of P(S)P(S) (wait) and V(S)V(S) (signal) operations executed in an arbitrary order on a counting semaphore, compute the extreme (maximum or minimum) initial semaphore value S0S_0 that guarantees or permits blocking of at least kk processes.

Formulas GATE uses

Total Valid Interleavings of Independent Thread Statements

Total Interleavings=(k1+k2+⋯+km)!k1!k2!…km!\text{Total Interleavings} = \frac{(k_1 + k_2 + \dots + k_m)!}{k_1! k_2! \dots k_m!}

Used to count all possible context-switched instruction sequences when mm threads execute k1,k2,…,kmk_1, k_2, \dots, k_m atomic instructions respectively.

Lost Update Overwrite Bound (Counting Semaphore Concurrency)

Vmin=X0−Ndecr,Vmax=X0+NincrV_{\text{min}} = X_0 - N_{\text{decr}}, \quad V_{\text{max}} = X_0 + N_{\text{incr}}

Used when counting semaphore S≥2S \ge 2 allows one thread to read the initial value X0X_0 and hold it while all opposite operations execute, overwriting all intermediate updates upon committing.

Dijkstra Resource Hierarchy Condition (Deadlock Prevention)

∀(Ri,Rj) requested in sequence by process Pk,f(Ri)<f(Rj)\forall (R_i, R_j) \text{ requested in sequence by process } P_k, \quad f(R_i) < f(R_j)

Used to verify whether an ordering of semaphore wait/P operations is guaranteed to be deadlock-free by ruling out circular wait.

Semaphore Blocking Condition

Sinit+NV<NPS_{\text{init}} + N_V < N_P

Determining the largest initial non-negative semaphore value SinitS_{\text{init}} such that at least one P(S)P(S) operation remains blocked when NPN_P wait operations and NVN_V signal operations are issued.

Net Available Permits After Execution

Available Permits=Sinit+NV−NPcompleted\text{Available Permits} = S_{\text{init}} + N_V - N_P^{\text{completed}}

Tracking permit consumption and remaining capacity across sequences of PP and VV invocations.

Examiner traps in Concurrency and Synchronization

  • Assuming separate OS processes share global variables when they actually maintain isolated address spaces.
  • Swapping the order of mutex semaphore `wait(mutex)` and counting semaphore `wait(empty/full)`, leading to nested wait deadlock.
  • Forgetting that local variables inside functions called by threads are allocated on per-thread stacks and are not shared.
  • Missing deadlock scenarios when all N threads perform the first of two consecutive `wait()` operations on a shared counting semaphore.
  • Overlooking that a preempted thread storing an early computed value completely overwrites all increments/decrements committed in the interim.
  • Assuming Bakery-style ticket algorithms guarantee progress without strict tie-breaking by process ID.
  • Confusing the violation of Progress with a violation of Bounded Waiting or Mutual Exclusion in strict alternation solutions.
  • Formulating non-strict vs strict inequalities for semaphore blocking (e.g., using S0 + NV ≤ NP instead of S0 + NV < NP when at least one process must remain blocked).
  • Assuming a fixed interleaving order when the problem specifies operations occur 'in some order' (requiring analysis of the best-case/worst-case permit availability).

How questions are asked

  • Trace and identify all reachable print string patterns (MSQ)
  • Find the minimum and maximum possible final value of a shared variable (MCQ/NAT)
  • Determine correct semaphore initialization values for a target execution trace (MCQ)
  • Analyze a synchronization snippet for Mutual Exclusion and Deadlock violations (MCQ/MSQ)
  • Find the deadlock-free acquisition order of multiple semaphores (MCQ)
  • Count the total number of distinct final values under all statement interleavings (NAT/MCQ)
  • Pseudocode synchronization requirement evaluation (MCQ/MSQ)
  • Semaphore permit threshold computation (NAT)

Paper trends

  • Shift from single-correct MCQs analyzing algorithm correctness towards multi-select questions (MSQs) tracing all possible interleaved execution paths and identifying multiple valid output strings or deadlock states.

    2026, 2024, 2021

  • Increased focus on counting semaphores enabling partial concurrency (e.g., initial value > 1), requiring candidates to analyze overwrite scenarios when multiple threads enter critical sections.

    2023, 2021, 2013

  • Rise in discrete combinatoric interleaving problems where candidates evaluate statement permutations (e.g., binom(n+m, n)) to deduce reachable states.

    2024, 2015

  • Questions are split between algorithmic reasoning on classic software synchronization primitives (e.g., strict alternation) and quantitative permit bounds via NATs on counting semaphores.

    2016

Difficulty notes

Easy items involve direct execution tracing of 2-3 threads with binary semaphores to find a fixed periodic printing sequence. Medium items require multi-step interleaving analysis, calculating maximum/minimum final values under counting semaphores, or detecting deadlocks in multi-threaded/multi-process code (especially MSQs with multiple valid interleaving outcomes). Hard items involve subtle algorithmic flaws (such as missing tie-breakers in Bakery variants or concurrent lock overwrites with atomic instructions) requiring rigorous counterexample construction.