GATE CSE Processes, Threads and IPC PYQs
GATE evaluates the 'Processes' topic primarily through the standard 5-state process lifecycle (New, Ready, Running, Blocked/Waiting, Terminated) and the valid/i… Read the guide
- Questions
- 15
- Asked
- since 2011
- Total marks
- 16
- Marks / paper
- 0.6
15 GATE CSE Processes, Threads and IPC PYQs with solutions, from Operating Systems. Browse all GATE CSE PYQs.
Questions
Every official paper that asked this topic, newest first.
- GATE CSE 2026 Set 1 · Q63Consider the following program snippet. Assume that the program compiles and runs successfully. Further, assume that the
fork()system call is always successful in creating a process.int main () { int i; for (i = 0; i < 3; i++){ if (fork() == 0){ continue; } break; } printf("Hello!"); return 0; }…NAT2 marksMediumSolve - GATE CSE 2025 Set 1 · Q29Suppose in a multiprogramming environment, the following C program segment is executed. A process goes into I/O queue whenever an I/O related operation is performed. Assume that there will always be a context switch whenever a process requests for an I/O, and also whenever the process returns from an I/O. The number…NAT1 markEasySolve
- GATE CSE 2024 Set 1 · Q24Which of the following statements about threads is/are TRUE?MSQ1 markEasySolve
- GATE CSE 2024 Set 1 · Q25Which of the following process state transitions is/are NOT possible?MSQ1 markEasySolve
- GATE CSE 2024 Set 2 · Q25Consider a process running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process moving to a non-running state (e.g., ready, blocked)?MSQ1 markMediumSolve
- GATE CSE 2023 · Q22Which one or more of the following need to be saved on a context switch from one thread (T1) of a process to another thread (T2) of the same process?MSQ1 markEasySolve
- GATE CSE 2020 · Q12Consider the following statements about process state transitions for a system using preemptive scheduling. I. A running process can move to ready state. II. A ready process can move to running state. III. A blocked process can move to running state. IV. A blocked process can move to ready state. Which of the above…MCQ1 markEasySolve
- GATE CSE 2019 · Q17The following C program is executed on a Unix/Linux system:
#include <unistd.h> int main() { int i; for (i=0; i<10; i++) if (i%2 == 0) fork(); return 0; }The total number of child processes created is _______.NAT1 markEasySolve - GATE CSE 2019 · Q23Consider three concurrent processes P1, P2 and P3 as shown below, which access a shared variable D that has been initialized to 100. Refer to the table below. The processes are executed on a uniprocessor system running a time-shared operating system. If the minimum and maximum possible values of D after the three…NAT1 markHardDiagramSolve
- GATE CSE 2017 Set 1 · Q18Threads of a process shareMCQ1 markEasySolve
- GATE CSE 2017 Set 2 · Q7Which of the following is/are shared by all the threads in a process? I. Program counter II. Stack III. Address space IV. RegistersMCQ1 markEasySolve
- GATE CSE 2015 Set 3 · Q1The maximum number of processes that can be in state for a computer system with CPUs isMCQ1 markEasySolve
- GATE CSE 2014 Set 1 · Q20Which one of the following is FALSE?MCQ1 markEasySolve
- GATE CSE 2012 · Q8A process executes the code
fork(); fork(); fork();The total number of child processes created isMCQ1 markEasySolve - GATE CSE 2011 · Q16A thread is usually defined as a “light weight process” because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the following is TRUE?MCQ1 markEasySolve
What GATE tests in Processes, Threads and IPC
Concepts, patterns, formulas and traps distilled from past papers.
GATE evaluates the 'Processes' topic primarily through the standard 5-state process lifecycle (New, Ready, Running, Blocked/Waiting, Terminated) and the valid/invalid transitions between these states. Questions consistently test the exact path of a process during execution, preemption, and I/O invocation. Recent trends show a progression from purely theoretical transition checks (MCQ/MSQ) to procedural tracing of state changes in C code execution (NAT).
Core concepts
- 5-state process lifecycle model (New, Ready, Running, Blocked/Waiting, Terminated)
- Valid direct state transitions versus illegal shortcuts (e.g., Blocked to Ready is valid, but Blocked to Running is illegal)
- Preemption mechanisms causing Running to Ready transitions (timer interrupts, quantum expiration)
- I/O blocking behavior: Running to Blocked on I/O request, and Blocked to Ready upon I/O completion
- Distinction between CPU-bound bursts and I/O-bound context switches in C code
- Thread-private state (Program Counter, Stack Pointer, General Purpose Registers, Thread Control Block)
- Process-shared resources (Address space, Page Table Base Register, open file descriptors, Heap, Data/Code segments)
- Intra-process vs. Inter-process context switching overhead
- Process lifecycle states (Ready, Running, Blocked/Waiting)
- Relationship between CPU count and maximum processes in the Running state
- Ready queue capacity independence from CPU count
- Thread execution context: Program Counter, Register Set, Stack (Thread-private)
- Shared process resources: Address space (code, global data, heap), Open files, Signal handlers
- User-level threads (ULT) vs. Kernel-level threads (KLT)
- Per-thread private resources (Stack, Registers/Program Counter, Thread Control Block)
- Process-shared resources (Heap, Data/Code segment, File Descriptor Table, Address Space)
- Memory protection and isolation within vs. across processes
- Process creation via `fork()` system call
- Parent vs child process relationship and hierarchy
- Binary process tree generation
- Process State Transitions (Running to Blocked vs Running to Ready)
- Blocking vs Non-blocking System Calls
- Page Fault Handling and Demand Paging I/O latency
- Hardware Interrupts and Interrupt Service Routines (ISR)
- Timer Interrupts and Time-slice Preemption Criteria
- Context Switching Mechanisms
- Per-thread vs per-process resources (stack/registers/TCB vs heap/data/code/page tables)
- User-level threads (ULT) vs Kernel-level threads (KLT) trade-offs and blocking semantics
- fork() return value semantics (0 in child, PID > 0 in parent)
- Process lifecycle and execution tree generation in loops with break/continue
- Non-atomic Read-Modify-Write instructions and shared memory race conditions
- Worst-case and best-case preemption scheduling for concurrent shared variable manipulation
Recurring question patterns
Process State Transition Validity
Commonmixed1 marks2024, 2020Questions present either a list of statements or transition pairs (e.g., Blocked to Running, Ready to Waiting) and ask to identify which transitions are valid, invalid, or possible under preemptive/non-preemptive models.
Code-Based Process Lifecycle Tracing
OccasionalNAT1 marks2025A C program containing system calls or standard I/O functions (such as scanf and printf) is provided, requiring the candidate to trace loop iterations and count how many times a process transitions between Running, Blocked, and Ready queues.
Thread Context Switch State Identification
RareMSQ1 marks2023Identifying which hardware registers, memory structures, and control blocks are saved/restored during an intra-process thread switch versus an inter-process context switch.
Process State Capacity vs Hardware Bounds
OccasionalMCQ1 marks2015Questions evaluating the theoretical maximum or limit on the number of processes in a specific state (e.g., Ready vs Running) relative to system parameters like CPU count ().
Thread Resource Sharing Identification
OccasionalMCQ1 marks2017Questions listing execution context elements (registers, stack, program counter, address space, file descriptors) and asking which are shared vs private among threads of the same process.
Thread Resource Sharing and Implementation Properties
RareMSQ1 marks2024Multi-statement conceptual evaluation assessing what resources (stack, heap, file descriptors, address space) are shared vs. private among threads, and implementation models (user space vs. kernel space).
Sequential Fork Process Counting
RareMCQ1 marks2012Determining the number of processes (or child processes) spawned by executing a sequence of unconditional
fork()system calls.Process State Transition and Mandatory Context Switch Analysis
OccasionalMSQ1 marks2024Evaluating which hardware or software events (blocking system calls, page faults, timer ticks, unrelated device interrupts) strictly force a running process to yield the CPU and transition to a non-running state (Blocked/Ready) versus events that merely execute an ISR and resume the running process.
Thread Resource Sharing and Thread Management Models
CommonMCQ1 marks2017, 2014, 2011Evaluating conceptual assertions about what is thread-private (program counter, registers, stack) versus process-shared (address space, heap, global variables, open files), as well as differences between user-level and kernel-level threads (context switch overhead, blocking calls, scheduling).
Process Creation & fork() Execution Tracing
CommonNAT1.5 marks2026, 2019Code snippets with loops executing fork() under conditional checks (e.g., modulo conditions or return-value checks like fork() == 0 with break/continue), requiring calculation of total child processes created or the count of specific print statements.
Race Conditions and Interleaving on Shared Variables
OccasionalNAT1 marks2019Analyzing concurrent processes performing arithmetic updates on a shared variable under uniprocessor time-sharing to determine the extreme possible values (minimum, maximum, or their range) caused by arbitrary preemption between atomic load, calculate, and store instructions.
Formulas GATE uses
Total Ready Queue Entries (from I/O)
Used when calculating how many times a process enters the ready queue during its lifecycle, paying close attention to whether the initial process admission () is explicitly included or excluded in the stem.
Maximum Running Processes Bound
Used when determining the upper limit of processes actively executing in a system with CPUs.
Total Processes Created by Consecutive Forks
Used to find the total number of processes (including the initial parent process) after unconditional sequential fork() calls.
Total Child Processes Created
Used when the question specifically asks for the number of *child* processes created by an initial parent executing consecutive fork() calls.
Total Processes from Sequential Forks
When unconditional sequential fork() system calls are executed in a program without branching.
Child Processes Created from Sequential Forks
Used to find the count of newly spawned child processes excluding the initial parent process after sequential unconditional forks.
Examiner traps in Processes, Threads and IPC
- Believing a blocked process can directly regain CPU and become Running upon I/O completion without re-entering the Ready queue.
- Assuming a process in Ready state can directly transition to Blocked/Waiting state without being dispatched to Running first.
- Off-by-one counting in NAT code-tracing by forgetting to exclude initial process placement in the ready queue when specifically instructed, or miscounting loop bounds (e.g., i < 20 vs i ≤ 20).
- Missing I/O operations located outside loop constructs (e.g., an initial `scanf` preceding a `for` loop of `printf`s).
- Confusing thread context switching with full process context switching by incorrectly including address translation registers (e.g., Page Table Base Register / PTBR) among saved items for intra-process thread switches.
- Assuming threads share stack space because they share the general virtual address space (each thread requires its own private stack and Stack Pointer).
- Confusing the maximum number of processes in the *Running* state (bounded by n CPUs) with the *Ready* state (bounded by memory/OS capacity, independent of n).
- Assuming the stack or registers are shared across threads; each thread must maintain its own private stack and register state for independent execution flow.
- Assuming global heap or address space is private per thread instead of shared.
- Assuming threads share a single common execution stack (each thread must have its own private stack).
- Believing each thread maintains its own independent open file descriptor table (file descriptors belong to the enclosing process).
- Assuming memory protection boundaries exist by default between threads of the same process (they share a single address space without OS-level inter-thread protection).
- Believing threads are strictly confined to kernel-space implementation (overlooking user-level thread libraries).
- Confusing total processes (2n) with child processes created (2n - 1), causing candidates to select 8 instead of 7.
- Assuming `fork()` creates a linear number of processes (n) rather than doubling at each step (2n).
- Confusing the execution of an Interrupt Service Routine (ISR) with a process context switch; handling an interrupt in kernel mode does not inherently move the interrupted process out of the running state.
- Assuming every timer interrupt causes a preemption; a timer tick updates kernel accounting and only triggers preemption if the process quantum has fully expired or a higher-priority task is awakened.
- Failing to recognize a page fault as a synchronous blocking event that must suspend the running process until secondary memory I/O completes.
- Confusing total processes (2n) with total child processes (2n - 1).
- Assuming heap or global variables are duplicated per thread rather than shared across all threads within the process.
- Thinking thread context switching requires no register saving; each thread has its own register state and stack pointer.
- Treating high-level statements like 'D = D + 20' as atomic rather than 3 separate assembly-level instructions (READ, ADD, WRITE).
- Failing to track how break/continue inside 'if (fork() == 0)' differentiates parent vs. child loop iteration counts.
How questions are asked
- Identify valid/invalid process transitions
- Multi-statement verification under preemptive scheduling
- Count process queue entries from a C program snippet
- Identify saved CPU registers during thread/process context switch (MSQ/MCQ)
- Classify resources as shared across threads or private to a thread
- Direct conceptual multiple-choice question on system resource scaling
- Roman numeral multi-statement identification of shared/private thread resources
- Conceptual multi-statement verification (MSQ)
- Count child or total processes in a short C/pseudocode snippet
- Conceptual multi-statement evaluation (MSQ) on OS events causing process state changes
- Conceptual TRUE/FALSE statement identification regarding thread states
- Trace C snippet containing fork() inside loops to count processes or prints
- Calculate minimum/maximum possible value of a shared variable under concurrent execution
Paper trends
Transitioned from traditional 1-mark single-choice conceptual questions to MSQs testing multiple invalid transitions simultaneously, and finally to NAT code-tracing problems mapping C I/O calls directly to process state changes.
2025, 2024, 2020
Recent exams leverage the MSQ format to test multiple components of thread-private state (e.g., Stack Pointer, Program Counter, General Purpose Registers) simultaneously, penalizing superficial knowledge.
2023
Questions are conceptual 1-mark items testing core definition-level distinctions (Ready queue independence from CPU count, and thread-private vs thread-shared memory resources).
2017, 2015
Recent papers leverage the MSQ format to test multiple precise conceptual boundaries regarding thread memory organization, protection models, and implementation spaces in a single question.
2024
Focuses on fundamental understanding of exponential process tree doubling via successive
fork()invocations.2012
Recent papers introduced fine-grained MSQ conceptual questions checking precise OS kernel mechanisms, such as distinguishing between an interrupt service routine (ISR) execution and an actual process context switch.
2024
Earlier papers (2011-2017) focused predominantly on 1-mark theoretical MCQs assessing thread memory isolation and kernel vs. user thread behavior.
2017, 2014, 2011
Recent examinations heavily emphasize NAT questions involving precise code tracing of fork() control logic and deep execution order interleaving for shared memory concurrency.
2026, 2019
Difficulty notes
All recent PYQs on this specific topic are 1-mark Easy questions. Easy questions directly test whether a student remembers the 5-state diagram arrows. Moderate/Hard variations introduce loop tracing with conditional I/O statements, parent-child fork hierarchies, or mixed timer preemption with I/O blocking.