Back to Study Material GATE Exam

Operating Systems Previous Year Questions

A systematic review of GATE OS questions from 2015 to 2024 reveals that process synchronization has been tested in every single paper, often with a two-mar...

Operating Systems Previous Year Questions

PYQ Patterns in GATE Operating Systems

A systematic review of GATE OS questions from 2015 to 2024 reveals that process synchronization has been tested in every single paper, often with a two-mark scenario-based question. The second most consistent topic is CPU scheduling numerical, followed by virtual memory and page replacement. Understanding the typical question structures allows you to recognize and solve them faster under exam conditions.

Synchronization PYQs fall into three categories. The first is semaphore trace: given a concurrent execution of two or more processes with specific semaphore operations, trace the semaphore values and determine which processes block, in what order they proceed, and whether deadlock or starvation occurs. The second is correctness analysis: given a proposed solution to the critical section problem, identify whether it satisfies mutual exclusion, progress, and bounded waiting. The third is problem-specific: identify the semaphore operations needed to solve producer-consumer, readers-writers, or dining philosophers within given constraints.

Scheduling PYQs almost always provide arrival times and burst times for a set of processes and ask for average waiting time, average turnaround time, or the completion time of a specific process under a named algorithm. GATE 2022 provided five processes with varying arrival and burst times and asked for average waiting time under preemptive priority scheduling — a question requiring a detailed Gantt chart.

Memory management PYQs include: translate a virtual address to physical given a page table; compute the number of page faults for a reference string under LRU or FIFO; determine maximum file size given i-node structure; compute effective memory access time with TLB. Each of these requires mechanical application of a known formula or procedure, so practice is the differentiator.

Deadlock PYQs often provide a resource allocation graph and ask whether deadlock exists (cycle detection), or provide the Banker's Algorithm state and ask whether a request can be granted. Know the safe sequence algorithm by heart: repeatedly find a process whose remaining need can be satisfied by current available resources, run it, release its allocation, and repeat until all processes finish (safe) or no such process exists (unsafe).

Worked Solutions for Classic OS PYQ Types

This section provides worked solutions for three recurring OS PYQ types to demonstrate the structured approach that earns full marks efficiently.

Type 1 — CPU Scheduling. Processes: P1 (arrival 0, burst 8), P2 (arrival 1, burst 4), P3 (arrival 2, burst 9), P4 (arrival 3, burst 5) under non-preemptive SJF. At time 0, only P1 is available, so P1 runs from 0 to 8. At time 8, available processes are P2 (burst 4), P3 (burst 9), P4 (burst 5). SJF selects P2. P2 runs from 8 to 12. Then P4 (burst 5) runs from 12 to 17. Then P3 runs from 17 to 26. Completion times: P1=8, P2=12, P4=17, P3=26. Turnaround times: P1=8, P2=11, P4=14, P3=24. Waiting times: P1=0, P2=7, P4=9, P3=15. Average waiting time = (0+7+9+15)/4 = 31/4 = 7.75.

Type 2 — Page Replacement. Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 with 3 frames using LRU. Trace: 1 (fault, frames:1), 2 (fault, 1,2), 3 (fault, 1,2,3), 4 (fault, replace 1 — LRU, frames:2,3,4), 1 (fault, replace 2, frames:3,4,1), 2 (fault, replace 3, frames:4,1,2), 5 (fault, replace 4, frames:1,2,5), 1 (hit), 2 (hit), 3 (fault, replace 5, frames:1,2,3), 4 (fault, replace 1, frames:2,3,4), 5 (fault, replace 2, frames:3,4,5). Total faults = 10.

Type 3 — Banker's Algorithm. Four processes P0-P3, three resources A=10, B=5, C=7. Allocation and Maximum matrices given; Need = Maximum minus Allocation. Available = Total minus sum of allocations. Find a safe sequence by iteratively selecting processes whose Need is less than or equal to Available. Grant their allocation to Available after completion. If all processes complete, state is safe.

Commonly Misunderstood OS Concepts in GATE PYQs

Certain OS concepts consistently trip up students in GATE, not because they are inherently difficult but because their definitions are subtly different from common intuition. Knowing these pitfalls can save you from losing marks on questions you have studied.

Turnaround time versus waiting time: students often compute waiting time but label it turnaround time. Turnaround time is the total time from arrival to completion and includes both CPU time and waiting time. Waiting time is only the time spent in the ready queue. The relationship is: turnaround time equals waiting time plus burst time (and any I/O time in more complex scenarios).

Response time versus waiting time: response time is the time from submission to the first CPU response, while waiting time is the total time spent waiting across all instances in the ready queue. For a process preempted multiple times, waiting time accumulates across all waits, but response time is measured only once at the first dispatch.

Safe state versus deadlock-free state: a safe state guarantees that all processes can eventually complete through some safe sequence. An unsafe state does not guarantee deadlock — it means deadlock is possible but not certain. The Banker's Algorithm avoids unsafe states, which is a more conservative guarantee than merely avoiding deadlock. Students sometimes incorrectly claim that an unsafe state means deadlock exists.

FIFO Belady's Anomaly: the anomaly says that with FIFO, adding more frames can sometimes increase page faults. Students expect more frames to always help. Remember that this anomaly applies only to FIFO; LRU and Optimal are stack algorithms and monotonically improve (or stay the same) with more frames. GATE has tested this distinction directly.

Semaphore versus mutex: a mutex can only be released by the thread that acquired it, enforcing ownership semantics. A binary semaphore has no ownership; any thread can signal it. This distinction matters for priority inversion problems, where a high-priority thread is blocked by a low-priority thread holding a mutex — the solution is priority inheritance, which is specific to mutexes, not general semaphores.