Operating Systems Complete Guide 2026 — Process, Threads, Scheduling, Deadlocks, Memory
💻 Operating Systems — Full Masterclass

Operating Systems 2026 —
Process, Scheduling, Deadlocks & Memory

Process vs Thread, CPU scheduling algorithms, all 4 deadlock conditions, Banker’s Algorithm, paging, and virtual memory — complete GATE CSE guide.

📅 Updated June 2026 🎯 GATE 6–10 Marks ⏱ ~16 Min Read 🔒 Deadlocks Deep Dive 📊 All Scheduling Algos
6–10
GATE Marks
4
Deadlock Conditions
5+
Scheduling Algorithms
5
Process States
3
Page Replacement Algos

Operating Systems (OS) is the software layer between hardware and user applications — it manages processes, memory, files, and devices. It is one of the highest-weightage GATE CSE subjects at 6–10 marks, and a standard topic in all placement technical interviews. Galvin’s OS Concepts (Silberschatz) is the gold-standard reference book for this subject.

1. What is an Operating System?

An Operating System is system software that acts as an intermediary between computer hardware and application programs. It manages the computer’s hardware resources and provides common services for programs. Without an OS, every application would need to directly manage hardware — an impossible task.

Key OS functions: Process management, memory management, file system management, I/O management, and security. Popular OS examples: Linux, Windows, macOS, Android.

2. Process vs Thread — Critical Difference

This is one of the most-asked topics in both GATE and placement interviews.

FeatureProcessThread
DefinitionProgram in execution — independent entityLightweight unit within a process
MemoryOwn address spaceShares process memory
ResourcesOwn file handles, I/O, PCBShares process resources
Context switchExpensive — save/restore full stateFast — less state to save
CommunicationIPC needed (pipes, sockets, shared memory)Direct via shared memory
IsolationCrash isolated to processOne thread crash can kill process
Creation overheadHeavyLight

3. Process States & PCB

A process goes through 5 states during its lifetime. The OS tracks each process using a data structure called the Process Control Block (PCB).

  PROCESS STATE DIAGRAM:

  [New] ──────create──────→ [Ready] ←──────────────────┐
                               |                        |
                           dispatch                  preempt
                               |                        |
                               ↓                        |
                          [Running] ──I/O request──→ [Waiting]
                               |                        |
                           terminate                 I/O done
                               |                        |
                               ↓                        |
                         [Terminated]           → [Ready] ←──┘

  PCB contains: PID, State, Program Counter, CPU Registers,
                CPU Scheduling info, Memory management info,
                I/O status, Accounting information
    
// 5 states: New → Ready → Running → Waiting → Terminated

4. CPU Scheduling Algorithms

CPU scheduling decides which process gets the CPU next. Key metrics: Turnaround Time (TAT) = Completion − Arrival, Waiting Time (WT) = TAT − Burst Time, Response Time = First response − Arrival.

FCFS
First Come First Served

TypeNon-preemptive
StarvationNo
Convoy EffectYes
OverheadMinimal

SJF
Shortest Job First

TypeNon-preemptive
StarvationYes (long jobs)
Avg WaitingMinimum
PracticalBurst unknown

SRTF
Shortest Remaining Time

TypePreemptive SJF
StarvationYes
Avg WaitingOptimal
GATE freqVery High

Round Robin
Time Quantum Based

TypePreemptive
StarvationNo
ResponseGood
Used inTime-sharing OS

Priority
Highest Priority First

TypeEither
StarvationYes (aging fix)
SJF relationPriority = 1/burst
FixAging technique

🎯 GATE Tip — CPU Scheduling Calculations

GATE numerical questions on scheduling are very common. Practice computing Gantt charts, TAT, WT, and average WT for FCFS, SJF, SRTF, and Round Robin. SRTF (preemptive SJF) is the hardest and most frequently tested. Draw the Gantt chart step-by-step — never skip this in GATE.

GATE Pattern — SRTF4 processes arrive at times 0,1,2,8 with burst times 10,13,6,9. Using SRTF — draw the Gantt chart, then compute average TAT and WT. This type of numerical appears almost every year.

5. Process Synchronization

When multiple processes share resources, race conditions can cause incorrect results. Synchronization ensures only one process accesses a critical section at a time.

A Critical Section is the code that accesses shared data. A good solution must satisfy: (1) Mutual Exclusion — only one process in CS at a time. (2) Progress — if no one is in CS, any process can enter. (3) Bounded Waiting — a process cannot wait forever.

🔐 Semaphore — The Classic Synchronization Tool A semaphore is an integer variable accessed only through two atomic operations: wait(S) — decrement S, block if S≤0; and signal(S) — increment S, wake a blocked process. Binary semaphore (0 or 1) is equivalent to a mutex lock. Counting semaphore allows N concurrent accesses.

6. Deadlocks — The 4 Necessary Conditions

A deadlock is a state where two or more processes are permanently blocked, each waiting for a resource held by another. ALL four Coffman conditions must hold simultaneously for a deadlock to occur — eliminate any one, and deadlock cannot happen.

01
Mutual Exclusion
At least one resource must be non-shareable. Only one process can use it at a time.
02
Hold and Wait
A process holds at least one resource while waiting to acquire additional resources held by other processes.
03
No Preemption
Resources cannot be forcibly taken away. A process must voluntarily release resources after completing its task.
04
Circular Wait
A closed chain exists: P1 waits for P2’s resource, P2 waits for P3’s, …, Pn waits for P1’s resource.
⚠️ GATE Critical Point All four conditions are necessary — and together they are sufficient for deadlock. To prevent deadlock, deny at least one condition. Eliminating “Circular Wait” is most practical — enforce a total ordering of resource types (processes must request resources in increasing order).

7. Banker’s Algorithm — Deadlock Avoidance

The Banker’s Algorithm (by Dijkstra) is a deadlock avoidance algorithm. Before granting a resource request, the OS simulates the allocation and checks if the resulting state is safe — meaning all processes can still complete by executing in some order (a safe sequence). If safe, grant it; if not, make the process wait.

  Banker's Algorithm — Safety Check:

  Given: Allocation, Max, Available matrices

  Need[i][j] = Max[i][j] - Allocation[i][j]

  Safety Algorithm:
  1. Work = Available; Finish[i] = false for all i
  2. Find process i where: Finish[i]=false AND Need[i] ≤ Work
  3. If found: Work = Work + Allocation[i]; Finish[i] = true; goto 2
  4. If all Finish[i]=true → SAFE STATE (safe sequence found)
     Else → UNSAFE STATE (potential deadlock)
    
// Safe state ≠ no deadlock; it means deadlock CAN be avoided

🎯 GATE Tip — Banker’s Algorithm

Banker’s Algorithm problems are a GATE staple. Given Allocation, Max, and Available matrices, find the safe sequence. Practice this until you can do it in under 5 minutes — it appears almost every year and can be 2 marks for a correctly traced sequence.

Classic GATE Banker’s Question3 processes, 4 resources: Allocation = {1,2,1 / 3,1,1 / 4,1,2}, Max = {8,6,4 / 4,3,3 / 10,1,3}, Available = {4,4,5}. Find Need matrix → find safe sequence.
Key: Compute Need = Max − Allocation first.

8. Memory Management — Paging & Segmentation

Paging divides logical memory into fixed-size pages and physical memory into frames of the same size. The OS maintains a page table to map logical page numbers to physical frame numbers. Paging eliminates external fragmentation but can cause internal fragmentation.

ConceptPagingSegmentation
DivisionFixed-size pagesVariable-size segments (code, data, stack)
FragmentationInternal onlyExternal only
User visibilityNot visibleVisible to programmer
AddressPage number + offsetSegment number + offset
ProtectionPer-page bitsPer-segment (read/write/execute)

9. Virtual Memory & Page Replacement Algorithms

Virtual Memory allows processes to use more memory than physically available, by storing pages on disk (swap space) and loading them on demand. When a referenced page is not in memory, a page fault occurs and the OS loads it from disk.

Page replacement algorithms decide which page to evict when memory is full:

AlgorithmHow it worksPractical?Page Faults
FIFOEvict the oldest page in memoryYesMost faults (Belady’s anomaly)
LRUEvict the Least Recently Used pageCostly to implementFewer than FIFO
OptimalEvict the page not needed for longest timeNot practical (future unknown)Minimum possible
⚠️ Belady’s Anomaly In FIFO page replacement, increasing the number of frames can sometimes increase the number of page faults. This counterintuitive behavior is called Belady’s Anomaly. LRU and Optimal do NOT suffer from Belady’s Anomaly.
Operating SystemsCPU SchedulingDeadlock Banker’s AlgorithmProcess vs ThreadPaging Virtual MemoryGATE CSE 2026Semaphore

10. Frequently Asked Questions

The four Coffman conditions are: (1) Mutual Exclusion — at least one resource is non-shareable; (2) Hold and Wait — a process holds a resource and waits for another; (3) No Preemption — resources cannot be forcibly taken; (4) Circular Wait — a circular chain of processes each waiting for a resource held by the next. ALL four must hold simultaneously.
A process is an independent program in execution with its own memory space and PCB. A thread is a lightweight unit within a process — threads share process memory but have their own stack and registers. Context switching between threads is faster. A process crash is isolated; a thread crash can kill its entire process.
OS typically carries 6–10 marks in GATE CSE. High-yield topics: CPU scheduling numerical (SRTF, RR), process synchronization (semaphores), deadlocks (Banker’s Algorithm), memory management (paging address translation), and page replacement algorithms (LRU, FIFO, Optimal). These topics repeat every year.
Banker’s Algorithm is a deadlock avoidance technique. Before allocating resources, it checks if the allocation keeps the system in a safe state — where all processes can eventually complete. If the resulting state is safe, the OS grants the request; otherwise it makes the process wait. It’s called “Banker’s” because it works like a bank that only grants loans if it can still meet all customers’ future needs.
EP
EnggPrep.in Team

Comprehensive GATE and placement guides for Indian CSE students — structured for maximum exam impact.

🎓 Continue Your GATE CSE Preparation

Read our complete GATE CSE 2026 guide covering all 11 subjects with strategy and resources.

GATE CSE Full Guide →

Leave a Comment