Unit I — Introduction · Processes · Threads · Scheduling
Unit I

Introduction, Processes, Threads & Processor Scheduling

Every Unit I question from the six 2023–2025 papers in OS Akash.pdf, plus older-paper questions for syllabus points those six never asked. Answers are sized to the marks that were actually printed on the question.

A. What is an Operating System

Introduction
Unit I · Introduction

Explain operating system and its functions. What is the difference between a process and a program?

Recent PYQ — must do End Term Dec 2025 · Q.2(a) 3 Marks Very high
Show answer

An Operating System is system software that acts as the interface between the user and the computer hardware. It manages the hardware and software resources of the system and provides services to application programs, so programs never touch hardware directly. Examples: Microsoft Windows, Linux, macOS, Android.

Functions of an OS

#FunctionWhat the OS actually does
1Process managementCreates, schedules and terminates processes; allocates CPU time.
2Memory managementAllocates and frees main memory; tracks usage; supports paging and segmentation.
3File managementCreates, deletes and organises files and directories; controls access permissions.
4Device managementControls I/O devices (keyboard, mouse, printer, disk) through drivers.
5CPU schedulingDecides which process gets the CPU and for how long; improves utilisation.
6Security and protectionUser authentication, access control, protection from unauthorised access.

Process vs program

A program is a passive set of instructions stored on disk. When the user runs it, the OS loads it into main memory and creates a process — a program in execution, an active entity with a program counter, registers, stack and allocated resources.

BasisProgramProcess
NaturePassive entityActive entity
Lives inDisk / SSDMain memory + a PCB
LifetimeUntil the file is deletedCreated → terminated
ResourcesNone allocatedCPU time, memory, files, devices
One file → many?Single fileMany processes from the same program

Example from the book: MS Word installed on your computer is a program; when you open it and it starts running, it becomes a process.

Unit I · Introduction

Discuss the services provided by the operating system.

Recent PYQ — must do End Term Jan 2024 · Q.2(a) 4 Marks High
Show answer
  1. Program execution — loads the program into memory and decides the order of execution using a scheduling algorithm (FCFS, SJF, …). When two programs become ready it keeps them from interfering, and it also handles deadlock.
  2. I/O operations — manages input/output and communicates with device drivers so a program can read or write without knowing how the hardware works, and keeps devices in sync.
  3. Communication between processes — transfers data between processes; when they are on different machines joined by a network, the OS manages that too.
  4. File management — grants file access, enforces read-only / read-write permissions, and decides how data is stored and retrieved on disk.
  5. Memory management — checks whether enough free space exists before loading a program, allocates it at a suitable location, and stops a program using memory that is not its own.
Exam tipFor 4 marks, five headings plus one line each is a full answer. Underline the verbs — loads, drivers, network, permissions, allocates.

B. Types of Operating Systems

Introduction
Unit I · Types of OS

How does multiprogramming differ from multitasking?

Recent PYQ — must do Mid Term Nov 2023 · Q.1(a) 2 Marks Very high
Show answer

Multiprogramming increases CPU utilisation by organising jobs (code and data) in main memory so the CPU always has one to execute; if the running job goes for I/O, the CPU is assigned to another job. Multitasking is a logical extension of it — the ability of an OS to execute more than one task simultaneously on a CPU, with those tasks sharing common resources such as CPU and memory.

BasisMultiprogrammingMultitasking
AimKeep the CPU busyMake progress on several tasks at once
Switch triggerRunning job needs I/OTime slice ends, even if CPU-bound
CPU countSingle CPU, jobs take turnsOne or more CPUs
RelationThe base ideaExtension of multiprogramming

One-liner to open with: “Multiprogramming keeps several jobs in memory so the CPU is never idle; multitasking keeps several tasks running at once by switching very fast.”

Unit I · Types of OS

Distinguish between batch systems and time-sharing systems.

Recent PYQ — must do End Term Jan 2024 · Q.1(a) 3 Marks Very high
Show answer

Batch OS — popular in the 1970s. Jobs with similar requirements are grouped and executed as a batch to speed up processing. Users do not interact with the computer directly: each prepares a job on an offline device such as a punch card and hands it to the operator, who sorts similar programs into batches.

Time-sharing OS — uses CPU scheduling and multiprogramming to give each user a small portion of a shared computer. Each user has at least one program in memory; a program runs a short time before finishing or requesting I/O. That interval is the time slice / time slot / quantum, typically 10–100 ms.

BasisBatch systemTime-sharing system
User interactionNone — offline submissionDirect, through a terminal
Unit of workA group (batch) of similar jobsOne process per user, time-sliced
SwitchingOnly when a job finishes or needs I/OEvery quantum, I/O or not
ObjectiveMaximise CPU throughputMinimise response time
Idle CPUNoticeable with I/O-bound jobsVery low
Typical usePayroll, bulk reportingUNIX/Linux login servers

Draw the batch diagram → Diagram Bank · Simple batch system.

Unit I · Types of OS

Explain Batch, Multiprogramming, and Time-Sharing Operating Systems. List their advantages and disadvantages as well.

Recent PYQ — must do Mid Term Oct 2024 · Q.4(b) 5 Marks Very high
Show answer
Batch vs Multiprogramming vs Time-sharing
TypeDescriptionAdvantagesDisadvantages
Batch OSExecutes batches of jobs with no user interaction. Jobs are collected, grouped and run sequentially.Efficient for large jobs; reduces idle CPU time between similar jobs.No user interaction; debugging is difficult; one bad job can stall the batch.
Multiprogramming OSKeeps multiple programs in memory at once; the CPU switches to another whenever the running one waits for I/O.Maximises CPU usage and throughput.Complex memory and process management; may lead to starvation.
Time-sharing OSMultiple users access the system concurrently; CPU time is divided into small slices allocated round-robin to each user.Quick response for users; supports interactive use.High overhead from frequent context switching; security is a challenge.

Related: multiprogramming vs multitasking · multiprogramming vs multiprocessing vs multitasking · multiprogramming, time sharing and RTOS in detail.

Unit I · Types of OS

Differentiate between Multiprogramming, Multiprocessing and Multitasking operating system.

Recent PYQ — must do End Term Dec 2024 · Q.2(c) 5 Marks Very high
Show answer

Multiprogramming — one or more programs are loaded in main memory ready to execute, but only one is on the CPU at a time. If the running program starts an I/O task (which by definition does not need the CPU), the OS may interrupt it and give control to another ready program — a context switch. No CPU time is wasted waiting for I/O. The goal is to keep the CPU busy as long as processes are ready. The OS must also protect each program's memory area from the others, and must handle programs that do not fit in memory at once — solved by paging and virtual memory.

Multiprocessing — refers to the hardware: more than one CPU (cores on one die, or several packages). Several programs execute at the same instant. A system can be both multiprogrammed and multiprocessed.

Multitasking — the general modern term for running multiple programs, processes, tasks or threads at the same time when they share a common processing resource. At any instant the CPU executes one task only; the illusion of parallelism comes from reassigning the CPU so quickly (a fair share called a quantum) that all seem to run together. A task here is often a “thread of execution”, not a whole application.

BasisMultiprogrammingMultiprocessingMultitasking
DescribesMemory + CPU scheduling policyHardware capabilityExecution model of a modern OS
CPU countUsually oneTwo or moreOne or more
Switch whenRunning job needs I/OEach CPU runs its own jobQuantum expires or task blocks
True parallelismNoYesOnly with more than one CPU
Main goalKeep CPU busyAdd computing powerFairness and responsiveness

Hook: multiprogramming = many programs in memory · multiprocessing = many processors · multitasking = many tasks in time. Both multiprogramming and multitasking systems are CPU time-sharing systems.

Unit I · Types of OS

What are Real-Time Systems, and why are they critical in certain applications?

Recent PYQ — must do Mid Term Oct 2024 · Q.1(a) 2 Marks First Term Feb 2019 · Q.1(a) Very high
Asked in: Mid Term Oct 2024 Q.1(a) (2) · First Term Feb 2019 Q.1(a) (2) · and inside Oct-2024 Q.4(a), Oct-2025 Q.4(a), Dec-2025 Q.1(b). The Oct-2024 print says “Refer Q.1(a) End Term Exam 2019 (Pg no. 1-2019)” — that page is the Feb-2019 First Term paper.
Show answer

A real-time system is an OS designed to respond to events within a strict time limit (a deadline). Correctness depends on both the result and the time at which the result is produced. Such systems are like super-fast computers that handle tasks needing quick responses.

Two types

  • Hard real-time — missing a deadline is unacceptable; “like urgent missions, they must be done exactly on time or something really bad could happen”. Examples: aircraft control systems, pacemakers, nuclear power plant control systems.
  • Soft real-time — important, but occasional late responses are tolerable. Examples: multimedia streaming, online gaming, video conferencing.

Working of an RTOS

  1. External events generate interrupts.
  2. The RTOS immediately schedules the highest-priority task.
  3. Tasks are executed within predefined deadlines.

Why they are critical

Application areaWhy real-time is critical
Medical devicesPrevent harm or death
Industrial automationEnsure precision and safety
Military / defenceTimely response in critical situations
Traffic controlAvoid accidents and ensure smooth flow
TelecommunicationsMaintain low latency and high availability
Full-marks chain for a 5-mark versionDraw four boxes — Sensor detects obstacle → Interrupt generated → RTOS schedules braking task → Vehicle stops immediately — then list advantages (predictable response time, high reliability, efficient task scheduling, suits mission-critical applications) and disadvantages (expensive development, complex design, limited flexibility, higher hardware requirements).
Unit I · Types of OS

Differentiate between Time Sharing Systems and Real Time Systems.

Recent PYQ — must do End Term Dec 2025 · Q.1(b) 5 Marks Very high
Show answer
BasisTime-sharing systemReal-time system
ObjectiveProvide quick response and fair CPU sharing among multiple usersComplete tasks within strict deadlines
Response timeFast, but not guaranteedDeterministic and guaranteed within a specified time
SchedulingUses time slices (quantum) to share CPU among users/processesUses priority-based scheduling to meet deadlines
ApplicationsMulti-user systems, UNIX, online terminalsAir traffic control, medical devices, industrial automation
Deadline requirementMissing a response time is usually acceptableMissing a deadline may cause system failure
FocusUser convenience and resource sharingTimely and predictable task execution
ExampleLinux server serving multiple users simultaneouslyCar airbag control that must deploy immediately during a collision
Unit I · Types of OS

Explain in detail Multiprogramming, Time Sharing, and Real-Time Operating Systems. Also mention their advantages and disadvantages in brief.

Recent PYQ — must do Mid Term Oct 2025 · Q.4(a) 5 Marks Very high
Show answer

1. Multiprogramming OS

Keeps multiple programs in main memory at the same time and executes them concurrently. When one process waits for I/O, the CPU switches to another, ensuring maximum CPU utilisation.

Working: several jobs are loaded into memory → the CPU executes one job → if that job needs I/O it is put into a waiting state → the CPU is assigned to another ready job → this continues until all jobs complete.

Example: Program A waiting for I/O, Program B running on CPU, Program C in the ready queue. When B finishes or waits for I/O, the CPU switches to C.

Advantages: better CPU utilisation · increased throughput · reduced CPU idle time · efficient use of system resources.
Disadvantages: complex memory management · requires CPU scheduling · possibility of deadlocks · longer response time for users.

2. Time-sharing OS

Allows multiple users or processes to share the CPU simultaneously by allocating a small time slice (quantum) to each.

Working: CPU divided into small time slices → each process gets a fixed quantum → when the quantum expires the CPU switches to the next process → switching is so fast that users feel they have exclusive access.

Example: with quantum = 2 ms, P1 → P2 → P3 → P1 → P2 → P3; each process gets CPU time round-robin.
Applications: multi-user systems · online reservation systems · shared computing environments.

Advantages: fast response time · supports multiple users simultaneously · fair CPU allocation · efficient resource sharing.
Disadvantages: frequent context-switching overhead · requires more memory · security and data-integrity issues · performance may degrade with many users.

3. Real-Time Operating System (RTOS)

Designed to respond to events within a strict time limit (deadline); correctness depends on both the result and when it is produced. Hard RTOS — missing a deadline is unacceptable (aircraft control, pacemakers, nuclear plant control). Soft RTOS — occasional misses acceptable (streaming, online gaming, video conferencing).

Advantages: predictable response time · high reliability · efficient task scheduling · suitable for mission-critical applications.
Disadvantages: expensive development · complex design · limited flexibility · higher hardware requirements.

Comparison
FeatureMultiprogrammingTime-sharingReal-Time OS
Main goalMaximise CPU utilisationProvide quick user responseMeet deadlines
UsersSingle or multipleMultiple usersUsually dedicated systems
CPU allocationWhen a process waitsFixed time quantumPriority-based scheduling
Response timeModerateFastDeterministic
ExamplesBatch processing systemsUNIX, LinuxVxWorks, QNX, RTLinux
PriorityCPU utilisationUser interactionDeadline satisfaction
Unit I · Types of OS

Explain the features of parallel systems and distributed systems.

Older PYQ — syllabus gap End Term May 2016 · Q.2(a) (5) · End Term Jun 2019 · Q.2(a) (5) Medium
Show answer
Why this is here“Parallel Systems” and “Distributed Systems” are named in your Unit I syllabus but are not asked in any of the six 2023–2025 papers. These older questions are the only PYQ evidence for them.

Parallel systems

  • More than one processor inside one computer system, closely coupled.
  • Tightly coupled — processors share main memory and a clock (symmetric or asymmetric multiprocessing); loosely coupled — each has its own memory.
  • Extra reliability: if one processor fails, the others take over its work at reduced speed (graceful degradation / fail-safe mode).
  • Higher throughput than a single processor for the same load.

Distributed systems

  • Several independent machines with their own memory and CPU, joined by a network — loosely coupled.
  • Resources (files, printers, CPU cycles) are shared across sites; the user sees one logical system.
  • Communication happens by message passing, not shared memory.
  • Benefits: load sharing, easy expansion, faster problem solving, site-failure tolerance. Costs: needs a protocol stack, weaker security model, no single global clock.
BasisParallelDistributed
CouplingTightly coupledLoosely coupled
MemoryShared main memoryPrivate memory per node
CommunicationDirect memory accessMessage passing over a network
ClockCommon clockNo common clock
One unit failsSystem continues, slowerThat node lost, rest continue

The 2019 print reads “Compare and Constrain Network, Parallel and distributed operating systems” — Constrain is the book's typo for contrast. Reproduced as printed so you recognise it.

Unit I · Types of OS

What are personal-computer systems?

Syllabus only — no direct PYQ Cover for safety
Show answer
Why this is hereIn your syllabus; not asked in either book. One paragraph is enough insurance.

A personal-computer system is a single-user microcomputer system. Its OS exists mainly to maximise user rather than system performance, because CPU and memory are cheap and the human is the bottleneck. Programs are run directly by the user, and most such systems historically were not designed to run multiple programs at once. Windows, macOS and desktop Linux provide a GUI, support applications and games, and give the user direct control of the hardware.

C. OS as a Resource Manager

Introduction
Unit I · OS as Resource Manager

Explain the statement: OS – A Resource Manager.

Recent PYQ — must do End Term Dec 2024 · Q.1(a) 5 Marks Very high
Show answer

The OS acts as a manager of the hardware and software resources of a computer. Those resources include CPU (processor), memory (RAM), disk storage, input/output devices, files and data, and processes and programs. The OS decides who gets what, how much and for how long, so that all programs and users get fair and efficient access without conflict or waste.

Functions as a resource manager
ResourceOS role
CPUSchedules which process runs and for how long (CPU scheduling)
MemoryAllocates and deallocates memory space to processes; protects one from another
DiskManages file storage, read/write operations and disk-space allocation
I/O devicesControls access to printers, keyboards, network cards etc.
ProcessesManages process creation, termination, synchronisation and communication

Every allocation request passes through three OS actions: decide (is the resource free and is the request legal?), record (update the table saying who holds what), and release (return the resource when the process finishes or blocks).

Unit I · OS as Resource Manager

What resources are typically managed by an operating system?

Recent PYQ — must do Mid Term Oct 2024 · Q.1(b) 2 Marks Very high
Show answer
ResourceManaged function
CPUScheduling and execution of processes
Main memory (RAM)Allocation, protection and swapping
Storage devicesFile systems, read/write operations
Files & file systemFile access, naming, permissions
I/O devicesCommunication, buffering, device drivers

For 2 marks the table plus one closing line is enough: “The OS is the arbiter — it grants, tracks and reclaims each resource so no two processes use the same one at the same time.”

D–F. Processes, Process States & Process Management

Processes
Unit I · Processes

Define Process. Explain the lifecycle / various states of a process with a suitable diagram. Discuss how PCBs are used in context switching.

Recent PYQ — must do Mid Term Nov 2023 · Q.4(a) Mid Term Oct 2025 · Q.2(a) 4–5 Marks Very high
Asked in: Mid Term Nov 2023 Q.4(a) · Mid Term Oct 2025 Q.2(a) (4 marks, where it is merged with PCB and context switching) · End Term May 2016 Q.3(c). One answer covers all.
Show answer

Definition

A process is a program in execution — an active entity needing CPU time, memory, files and I/O. The objective of multiprogramming is to have some process running at all times to maximise CPU utilisation; the objective of time sharing is to switch the CPU among processes so frequently that users can interact with each program while it runs. To meet these objectives the process scheduler selects an available process (from the set of several available processes) for program execution on the CPU.

On a single-processor system there will never be more than one running process; if there are more processes, the rest must wait until the CPU is free and can be rescheduled.

Five states

  1. New — the process is being created.
  2. Ready — admitted to memory, waiting only for CPU time.
  3. Running — instructions are being executed.
  4. Waiting / Blocked — waiting for an event other than CPU (I/O completion, a signal).
  5. Terminated — finished; the OS reclaims its resources.
Fig D-1 · Process state transition diagram
NEW READY RUNNING TERMINATED WAITING /BLOCKED admitted schedulerdispatch exit I/O or event wait I/O or eventcompletion interrupt / preemption Only ONE process is ever in RUNNING on a single CPU. Ready → Running → Ready is the only loop not caused by I/O.
How to draw this in exam
  1. Four ovals in a row across the top: New · Ready · Running · Terminated.
  2. One more oval, Waiting/Blocked, below and between Ready and Running.
  3. Label the straight arrows: admitted, scheduler dispatch, exit.
  4. Add the curved pair: Running → Waiting (“I/O or event wait”) and Waiting → Ready (“I/O or event completion”).
  5. Finish with Running → Ready labelled “interrupt / preemption”.

Extended (seven-state) version

TransitionCause
New → ReadyAdmitted by the long-term scheduler
Ready → RunningShort-term scheduler dispatches
Running → ReadyTime quantum expired / interrupt / preempted by higher priority
Running → WaitingI/O request or an event the process must wait for
Waiting → ReadyI/O or event completion
Ready → Suspended-ReadyMedium-term scheduler swaps the process out to free memory
Suspended-Ready → ReadySwapped back in when memory frees up
Running → TerminatedNormal exit or forced termination

How the PCB is used in a context switch

  1. A timer interrupt or quantum expiry stops the running process.
  2. The OS saves the CPU registers and program counter into that process's PCB and sets its state to ready (or waiting).
  3. The scheduler picks the next process and reads its PCB.
  4. The OS restores registers and program counter from the new PCB, sets the state to running and jumps to the restored address.

Practice the numbers from this section → Numericals · CPU Scheduling.

Unit I · Process Management

Explain Process Control Block (PCB). Draw the block diagram of process control block / process transition states.

Recent PYQ — must do End Term Jan 2024 · Q.2(b) 6 Marks Mid Term Oct 2024 · Q.2(a) 5 Marks Very high
Asked in: End Term Jan 2024 Q.2(b) (6) · Mid Term Oct 2024 Q.2(a) (5). The Oct-2024 print says “Refer Q.2(b) End Term Exam January 2024 (Pg no. 8-2023)” — same question. Also Jul-2023 Q.1(c) and Jul-2016 Q.1(c).
Show answer

A Process Control Block (PCB) — also called a process descriptor or task control block — is the data structure the OS uses to store everything it needs about one process. With the creation of a process a PCB is created, which controls how that process is being carried out. Its aim is to help the OS manage the enormous number of tasks being carried out: the OS creates a PCB for every process, and it contains all the important information about that process, which the OS later uses to manage and run processes efficiently.

Block diagram — fields of a PCB

PCB lives here
Operating System (process table)
PCB of P1
PCB of P2
PCB of P3
Main memory (RAM)
Fields inside one PCB
Process State
Process ID
Program Counter
CPU Registers
Memory Management Info
Process Scheduling Info
Accounting Info
I/O status · open files

A cleaner, bigger version for exam practice → Diagram Bank · PCB block diagram.

Primary terminologies related to the PCB

FieldWhat it holds and why the OS needs it
Process stateStored in the PCB so the OS can manage and schedule the process — “running”, “waiting”, “ready” or “terminated”.
Process IDA unique number the OS assigns as soon as the process is created; distinguishes processes from one another.
Program counterAddress of the next instruction to execute. On a context switch the current value is saved here so execution resumes exactly where it left off.
CPU registersAccumulators, index registers, stack pointer. The PCB keeps a copy so register state can be restored.
Memory informationBase address / limit registers, page table, segment table — helps the OS allocate memory to the process efficiently.
Process scheduling informationPriority and the algorithm state, stored in the PCB to help the OS make scheduling decisions.
Accounting informationCPU time used, memory used, time limits — helps the OS monitor the performance of the process.
Line that earns the mark“The PCB is the OS's bookkeeping record for a process; without it a process could be suspended and never correctly resumed.”
Unit I · Processes / Threads

Differentiate between Process and Thread. Describe the process and thread with a suitable example.

Recent PYQ — must do End Term Dec 2024 · Q.2(a) 4 Marks Mid Term Oct 2025 · Q.1(c) 2 Marks High
Asked in: End Term Dec 2024 Q.2(a) (4) · Mid Term Oct 2025 Q.1(c) (2) · First Term Feb 2019 Q.1(c) (2). One table covers all three.
Show answer

A process is an independent program in execution with its own address space. A thread is the smallest unit of CPU execution within a process — a lightweight process. One process may contain several threads that share the same code, data and resources but execute independently.

Example

  • Process: open a web browser, a music player and a text editor — three separate processes.
  • Thread: inside the one browser process, one thread draws the user interface, one downloads pages, one plays video.
AspectProcessThread
DefinitionAn independent program in executionA lightweight unit of execution within a process
Memory spaceEach process has its own separate memory spaceThreads of the same process share memory and resources
CommunicationIPC is complex and slower (needs the kernel)Threads can easily communicate with each other (shared memory)
OverheadHigh — more resources needed to manage processesLow — threads are more efficient and lightweight
Creation timeCreating a process is slowerCreating a thread is faster
Context switchSlower — address space must be swappedFaster — only registers and stack change
Own resourcesPCB, code, data, heap, stack, file tableOnly its stack, program counter and register set
Failure effectCrash is isolated to that processA crashing thread can bring down the whole process

G. Interrupts

Processes
Unit I · Interrupts

What is an interrupt? Explain its types and the role of an interrupt handler.

Syllabus only — no direct PYQ Cover for safety
Show answer
Why this is here“Interrupts” is named in the Unit I syllabus but is not asked as a standalone question in either book. It appears inside other answers (I/O completion, the timer that ends a quantum, preemption), so learn the short version.

An interrupt is a signal to the CPU that some event needs attention. The CPU suspends the current instruction stream, saves just enough state to come back, and jumps to a kernel routine that services the event. Interrupts are how the OS gets control without the program's cooperation — without them there would be no preemption, no I/O completion and no time sharing.

TypeSourceExamples
Hardware / external interruptA device outside the CPUI/O completed, timer tick, key pressed
Machine-check interruptCPU or memory hardwareParity error, power failure
Trap (software interrupt)The running instruction itselfsystem() call, divide by zero, page fault, invalid opcode

What the handler does

  1. The device raises the interrupt line; the CPU finishes the current instruction.
  2. The CPU saves the program counter and flags on the kernel stack.
  3. The interrupt vector — a table of handler addresses — is indexed by the interrupt number to find the right interrupt service routine.
  4. The ISR services the device and, for an I/O interrupt, moves the waiting process from waiting to ready in its PCB.
  5. On return the OS may run the scheduler; if a higher-priority process is now ready, a context switch happens instead of returning to the interrupted process.

H. Interprocess Communication

Processes
Unit I · IPC

What are the advantages of inter-process communication? How does communication take place in a shared-memory environment?

Recent PYQ — must do End Term Jan 2024 · Q.4(a) 7.5 Marks Very high
Show answer

Advantages of IPC

  1. Enables processes to communicate with each other and share resources, leading to increased efficiency and flexibility.
  2. Facilitates coordination between multiple processes, leading to better overall system performance.
  3. Allows the creation of distributed systems that can span multiple computers or networks.
  4. Can be used to implement various synchronisation and communication protocols such as semaphores, pipes and sockets.

Shared memory vs message passing

BasisShared memoryMessage passing
How data movesBoth processes map the same region of their address space onto one physical region, then read/write it directlyA sends a message; the OS copies it into the receiver's space
SpeedFast for large amounts of data — no kernel copy per exchangeSlower for bulk data; every send/receive is a system call
SetupRegion must be created, attached and its size agreed in advanceNo setup beyond a channel
SynchronisationMust be done by the processes themselves (semaphores / mutex) — race conditions are the main hazardProvided by the OS inside send/receive
Best forMany small exchanges between processes on the same machineFew messages, or processes on different machines

Diagram → Diagram Bank · Shared memory and message passing.

Producer–Consumer with a bounded buffer

Two processes share a common buffer. The producer puts items in; the consumer takes them out. The unbounded-buffer version places no limit on size, so the producer never waits. The bounded-buffer version allows at most n items, so the producer must wait when the buffer is full and the consumer must wait when it is empty — and because both touch the buffer at the same time, access must be mutually exclusive.

semaphore mutex = 1;   // protects the buffer
semaphore full  = 0;   // number of filled slots
semaphore empty = n;   // number of free slots

Producer                 Consumer
while (true) {           while (true) {
  produce an item;         wait(full);
  wait(empty);             item = remove from buffer;
  wait(mutex);             signal(mutex);
  add item to buffer;      signal(empty);
  signal(mutex);           consume the item;
  signal(full);          }
}

Full synchronisation treatment → Synchronization.

Unit I · IPC

Explain the various types of inter-process communication. Give an illustration for each.

Older PYQ — important variant End Term May 2016 · Q.4(a) (6) · End Term May-June 2018 · Q.1(a) High
Show answer
IPC mechanismHow it worksIllustration
Shared memoryOS creates a region mapped into both address spaces; processes read/write it directlyProducer and consumer sharing a circular buffer of n slots
PipesUnidirectional byte stream; one process writes at the write end, another reads at the read endls | wc -l in a shell
Message queuesKernel keeps a linked list of typed messages; processes send/receive by keyA logging daemon collecting messages from many services
SocketsTwo-way endpoint identified by IP + port; works across machinesA browser talking to a web server over TCP
SignalsAsync notification delivered to a process, which runs its handlerCtrl+C sending SIGINT
Memory-mapped filesA file mapped into memory so two processes see the same bytesTwo editors sharing one config file

The 2018 paper asks this as a comparison of IPC with mutual exclusion — the shared-memory row is the answer to both framings.

I–K. Threads, Thread Operation & Threading Models

Threads
Unit I · Threads

State the life-cycle of a Thread.

Recent PYQ — must do End Term Jan 2024 · Q.1(b) 3 Marks Very high
Show answer

In a process, a thread refers to a single sequential activity being executed; these activities are also known as threads of execution or thread control. Any OS process can execute a thread, so a process may have multiple threads. When a thread moves through the system it is always in one of five states (excluding the CREATION and FINISHED end points): 1. Ready · 2. Running · 3. Waiting · 4. Delayed · 5. Blocked.

How a thread moves between them

  1. When an application is to be processed, it creates a thread.
  2. Required resources (for example a network) are allocated to it and it enters the READY queue.
  3. The thread scheduler (like a process scheduler) assigns it a processor — it enters RUNNING.
  4. If the thread needs some external event to be triggered first (another process completing), it moves RUNNING → WAITING.
  5. A thread that can deliberately sleep for a fixed time moves RUNNING → DELAYED. Example: the snooze function of an alarm — after it rings once and is not switched off, it rings again after a set interval; during that interval the thread is put to sleep.
  6. If the thread generates an I/O request and cannot move further until it is done, it moves RUNNING → BLOCKED.
  7. After the process is completed, the thread moves RUNNING → FINISHED.
Exam tipDraw Creation → Ready → Running → Finished as a straight line of four boxes, hang Waiting / Delayed / Blocked below Running, and add one dashed arrow from each back to Ready. Full version → Diagram Bank · Thread life-cycle.
Unit I · Thread Operation

What are threads? What is the difference between user-level threads and kernel-level threads? Under what circumstances is one better than the other?

Recent PYQ — must do End Term Dec 2024 · Q.2(a) 4 Marks End Term Dec 2025 · Q.3(a) 5 Marks End Term Jul 2023 · Q.5(a) Very high
Asked in: Dec-2024 Q.2(a) (4) · Dec-2025 Q.3(a) (5) · Jul-2023 Q.5(a) (6). The Dec-2025 print also asks the “under what circumstances is one better” half, which is the Situation / Better Choice / Reason table at the end of this answer.
Show answer

A thread is the smallest unit of CPU execution within a process. A process may contain one or more threads that share the same memory, code and resources but execute independently. Example: in a web browser, thread 1 = user interface, thread 2 = downloading web pages, thread 3 = playing video — all belonging to the same browser process.

User-Level Threads (ULT)

Managed by a thread library in user space, without direct support from the OS kernel. Thread creation and management are done by the user-level library; the kernel is unaware of these threads.

  • Characteristics: faster to create and switch; low overhead; portable across operating systems.
  • Disadvantages: if one thread performs a blocking system call the entire process may block, because the kernel sees only one process; cannot fully utilise multiple CPUs.

Kernel-Level Threads (KLT)

Managed directly by the operating system kernel, which schedules each thread independently. Each thread is known to the OS.

  • Advantages: one blocked thread does not block the entire process; better support for multiprocessor systems; true parallel execution is possible.
  • Disadvantages: thread creation and switching are slower; higher overhead due to kernel involvement.
AspectUser-level threadsKernel-level threads
Managed byThread library in user spaceOperating system kernel
Kernel awarenessUnknown by the kernelKnown to the kernel
Creation / switch costCheap — no system callExpensive — kernel trap each time
Blocking system callBlocks the whole processBlocks only that thread
Runs on many CPUsNoYes
Cost to maintainLowHigher — needs a kernel data structure per thread
PortabilityHighDepends on the kernel
ExamplesPOSIX Pthreads (original), Java threads (classic VM)Windows threads, Linux clone() tasks

When is one better than the other?

SituationBetter choiceReason
Frequent thread creation and switchingUser-levelLower overhead and faster execution
High performance with minimal OS interactionUser-levelEfficient thread management
Multiprocessor or multicore systemsKernel-levelThreads can run in parallel on different CPUs
Applications with many blocking I/O operationsKernel-levelBlocking one thread does not stop others
Real-time and server applicationsKernel-levelBetter scheduling and responsiveness

Related short question (Jun 2019 Q.4(c)): a thread needs only a stack, program counter and register set when created; a process needs all of that plus its own address space, page table, file table and PCB.

Unit I · Threading Models

How does the many-to-one model differ from the one-to-one model? Explain the threading models.

Older PYQ — syllabus gap End Term May 2016 · Q.1(e) 3 Marks Medium
Show answer
Status“Threading Models” is named in your syllabus. Only the many-to-one vs one-to-one pair has ever been asked (May 2016); many-to-many has no PYQ at all in either book, so learn the third model for completeness. The visual comparison is on Diagram Bank · Threading models.
ModelMappingAdvantageLimitation
Many-to-OneMany user-level threads → one kernel thread Thread management is done by the thread library in user space, so it is efficient; works on an OS without kernel thread support The entire process blocks if one thread makes a blocking system call; only one thread can access the kernel at a time, so threads cannot run in parallel on multiprocessors
One-to-OneEach user thread → its own kernel thread Provides more concurrency than many-to-one — another thread can run when one makes a blocking call; multiple threads run in parallel on multiprocessors Every user thread costs a kernel thread, so creation is expensive and the thread count must be limited
Many-to-ManyMany user threads → a smaller or equal pool of kernel threads Combines both: several threads can run in parallel and creating many user threads is cheap; the OS can give a process more kernel threads when it needs more CPU Most complex to implement; needs careful scheduling between the two levels
Two-tier (variant)Some threads 1:1, the rest multiplexed onto kernel threads Practical compromise used by some systems Only the bounded number of kernel threads can run in parallel

L–N. Processor Scheduling Theory

Scheduling
Unit I · Scheduling Levels

Describe short-term, medium-term and long-term scheduler. Draw the queueing-diagram representation of process scheduling and differentiate the three schedulers.

Recent PYQ — must do End Term Jan 2024 · Q.2(c) 5 Marks Mid Term Oct 2024 · Q.1(e) 2 Marks End Term Dec 2024 · Q.3(b) 6 Marks Very high
Asked in three of the six recent papers — Jan-2024 Q.2(c), Oct-2024 Q.1(e), Dec-2024 Q.3(b). Learn all three parts together.
Show answer

Process scheduling is the activity of the process manager that removes the running process from the CPU and selects another process based on a particular strategy. It is an essential part of a multiprogramming operating system: such systems allow more than one process to be loaded into executable memory at a time, and the loaded processes share the CPU using time multiplexing.

The three schedulers

| Scheduler | Role | Frequency | Speed |
SchedulerMain roleFrequencySpeed / focus
Long-Term (Job scheduler)Admits processes from the new queue into the ready queue; controls the degree of multiprogrammingInfrequent — seconds or minutesSlow; controls multiprogramming level; load balancing
Short-Term (CPU scheduler)Selects which ready process gets the CPU next and dispatches itVery frequent — millisecondsMust be very fast; maximises CPU utilisation
Medium-Term (Swapper)Swaps processes out of main memory and later back in, to reduce multiprogramming under memory pressureOccasionallyMedium speed; memory management
AspectLong-TermShort-TermMedium-Term
Alternate nameJob schedulerCPU schedulerSwapper
Main roleAdmits processes to the systemSelects process for CPUSwaps processes in / out of RAM
Execution frequencyInfrequentVery frequent (ms)Medium
ControlsMultiprogramming levelCPU utilisationMemory load
Location in diagramBetween new and readyBetween ready and runningBetween ready/suspend and ready
Why a long-term scheduler may not existIn time-sharing systems the long-term scheduler is often absent — every user is already “admitted”, so admission control is done by the human logging in.

The queueing diagram itself → Diagram Bank · Scheduling queues. Draw it every time this question is worth 5+ marks.

Unit I · Scheduling

Define the difference between preemptive and non-preemptive scheduling. State why strict non-preemptive scheduling is unlikely to be used in a computer.

Recent PYQ — must do End Term Dec 2024 · Q.2(b) 3.5 Marks Mid Term Oct 2025 · Q.1(a) 2 Marks End Term Oct 2025 · Q.3(b) 5 Marks Very high
Asked in three recent papers: Dec-2024 Q.2(b), Oct-2025 Q.1(a) and Oct-2025 Q.3(b). Both Oct-2025 prints say “Refer Q.2(b) from End Term Exam Dec. 2024”, so this is one master answer.
Show answer

Scheduling falls into one of two categories:

  • Non-preemptive — once the CPU has been allocated to a process, the process keeps the CPU until it finishes or voluntarily blocks. Its resources cannot be taken away before it is done; when the running process finishes and moves to the waiting state, resources are released and switched.
  • Preemptive — the OS assigns resources for a predetermined period. The process switches from running to ready, or from waiting to ready, during resource allocation; this happens because the CPU may give other processes priority and substitute the currently active process for a higher-priority one.
AspectPreemptive schedulingNon-preemptive scheduling
DefinitionCPU can be taken away from a running process before it finishesCPU is given to a process and runs until completion or until it blocks
ControlThe OS has control over process switchingThe process has control over when to release the CPU
Response timeBetter for real-time and interactive systemsSlower, especially for short urgent tasks
Starvation riskHigher (some processes may be preempted too often)Lower (every process eventually gets full CPU time)
Context-switch overheadHigher — more switchesLower — fewer switches
Decision happens whenrunning→ready (interrupt) or blocked→readyrunning→waiting, or running→terminated
AlgorithmsRound Robin, SRTF, preemptive priorityFCFS, SJF, non-preemptive priority
Shared dataNeeds care — a process can stop mid-update, leaving inconsistent dataSafer inside critical sections

Worked mini-example (printed in the Oct-2025 paper)

Two processes: P1 AT 0, BT 10 ms and P2 AT 2, BT 4 ms.

02614
P1P2

Preemptive (SRTF): P1 starts at 0. At time 2, P2 arrives with a shorter burst, so the CPU interrupts P1 and runs P2 to completion at 6; P1 then resumes and finishes at 14. That interruption of P1 is what makes the scheduling preemptive.

01014
P1P2

Non-preemptive (FCFS): P1 starts at 0, P2 arrives at 2 but must wait until P1 finishes at 10, then runs to 14. P1 is never interrupted — that is non-preemptive scheduling.

Why strict non-preemptive scheduling is unlikely in modern systems

  • Poor responsiveness — once a process starts it runs to completion regardless of the priority or urgency of other tasks, so an interactive command can wait behind a long batch job.
  • Not suitable for multitasking — in older OSs one whole program kept running until it blocked; in modern OSs time sharing is best manifested because each running process takes only a fair quantum of CPU time.
  • Blocking issues — a CPU-bound process holds the CPU while I/O-bound processes wait, so I/O devices sit idle and then all queue up at once (the convoy effect).
  • No interrupt handling — the OS could not react to a timer or a device in the middle of a process, so deadlines and preemption become impossible.
Unit I · Scheduling Criteria

What are various scheduling criteria for CPU scheduling? / Explain the criteria for choosing a CPU scheduling algorithm.

Recent PYQ — must do End Term Dec 2025 · Q.1(a) 5 Marks End Term Jan 2024 · Q.1(d) 2 Marks Very high
Asked in: Dec-2025 Q.1(a) (5) · Jan-2024 Q.1(d) (2, whose printed answer says “Refer to Q.1(h) of End Term Examination 2018 (Pg. No. 10–2018)”, which is “Define the criteria of comparison among CPU scheduling algorithms” (2.5) · also Jul-2016 Q.3(a), May-June 2017 Q.1(f). Same six criteria every time.
Show answer

There are several criteria to check when deciding which scheduling algorithm is “best”. In general CPU utilisation and throughput are maximised while the other factors are reduced for proper optimisation.

CriterionDefinitionWanted direction
1. CPU utilisationMake the best use of the CPU and waste no cycle; ideally the CPU works 100% of the time. In a real system usage ranges from about 40% (lightly loaded) to 90% (heavily loaded).Maximise
2. ThroughputTotal number of processes completed per unit time (or the amount of work done in a unit time). May range from 10/second to 1/hour depending on the processes.Maximise
3. Turnaround timeTime taken to execute a particular process — the interval from the time of submission to the time of completion (wall-clock time). TAT = CT − AT.Minimise
4. Waiting timeSum of the periods spent waiting in the ready queue to acquire control of the CPU. WT = TAT − BT.Minimise
5. Load averageAverage number of processes residing in the ready queue waiting for their turn to get into the CPU.Minimise
6. Response timeTime from when a request was submitted until the first response is produced — not the completion of execution.Minimise
Verification noteThe Jan-2024 paper prints only “(2)” and refers you to another paper for the content. The six criteria above are the ones printed in the Dec-2025 and 2018 answers, so they are the safe list. Some textbooks list only five (dropping load average) — if the question is worth 2 marks, write the five without load average.

Formulas and worked numbers → Numericals · CPU Scheduling · Revision · Formula sheet.

Unit I · Scheduling

Illustrate the significance of the terms demand scheduling and real time scheduling.

Recent PYQ — must do End Term Jan 2024 · Q.3(b) 5 Marks Very high
Show answer

Real-time scheduling

Real-time systems are like super-fast computers that handle tasks needing quick responses. There are two types of tasks:

  • Hard real-time tasks — like urgent missions; they must be done exactly on time or something really bad could happen.
  • Soft real-time tasks — important too, but it is okay if they are a bit late sometimes; nothing terrible will happen.

Real-time tasks are the super-important missions that need quick responses: some must be done right away (hard), others can wait a little (soft). The scheduler's job is to guarantee that deadlines are met, which is why it is priority-driven and preemptive.

Demand scheduling

Scheduling is the process by which the process manager removes an active process from the CPU and selects another process based on a specific strategy. Process scheduling is an integral part of a multiprogramming application set: more than one process is loaded into usable memory at a time and the loaded processes share the CPU using repetition time (time multiplexing). There are three types of process schedulers — long term (job), short term (CPU) and medium term.

Objectives of demand scheduling

  • Utilisation of CPU at maximum level — keep the CPU as busy as possible.
  • Allocation of CPU should be fair.
  • Throughput should be maximum — the number of processes that complete their execution per time unit should be maximised.
  • Minimum turnaround time — time taken by a process to finish execution should be the least.
  • Minimum waiting time — and the process should not starve in the ready queue.
  • Minimum response time — the time when a process produces its first response should be as less as possible.
Exam tipThese six objectives are the same list as the six scheduling criteria, just phrased as goals. If both questions appear in the same paper, write the criteria version for one and the objectives version for the other so you do not look like you are repeating yourself.
Unit I · Scheduling

What is Convoy effect? How [can its avoidance] improve the performance of a system?

Recent PYQ — must do End Term Dec 2024 · Q.1(b) 5 Marks High
Show answer

The Convoy Effect is a phenomenon associated with the First Come First Serve (FCFS) algorithm in which the whole operating system slows down because of a few slow processes.

FCFS is non-preemptive: once CPU time has been allocated to a process, other processes get CPU time only after the current process has finished. This property produces the convoy situation.

How it happens, step by step

  1. Suppose one CPU-intensive process (large burst time) is in the ready queue, together with several processes with relatively less burst time that are I/O-bound.
  2. The I/O-bound processes are allocated CPU time first — they are quickly executed and then go to their I/O queues.
  3. Now the CPU-intensive process is allocated CPU time. Because its burst time is high it takes a long time to complete.
  4. While it is running, the I/O-bound processes complete their I/O operations and are moved back to the ready queue.
  5. However, the I/O-bound processes are made to wait, because the CPU-intensive process still has not finished. This also leaves the I/O devices idle.
  6. When the CPU-intensive process ends it is sent to the I/O queue so it can access an I/O device. Meanwhile the I/O-bound processes get CPU time and move back to the I/O queue.
  7. But now they are made to wait again because the CPU-intensive process is still accessing its I/O device — so the CPU sits idle.

Hence in the convoy effect one slow process slows down the performance of the entire set of processes and wastes CPU time and other devices.

Fix to write in the answerTo avoid the convoy effect, use preemptive scheduling algorithms such as Round Robin, because smaller processes do not have to wait long for CPU time — their execution finishes faster and fewer resources sit idle. SJF / SRTF also help by putting short jobs first.
Unit I · Scheduling Algorithms

Explain the various CPU scheduling algorithms (FCFS, SJF, SRTF, Round Robin, Priority, Multilevel Queue).

Recent PYQ — must do Asked numerically in every recent paper High
Theory asked as: Dec-2024 Q.3(a) (6.5, four algorithms on one table) · Oct-2024 Q.4(a) (5) · Dec-2025 Q.2(b) (7, four algorithms). The same five algorithms come back every year as numericals — see Numericals.
Show answer
AlgorithmRulePreemptive?Best forMain drawback
FCFS (First Come First Served)Run processes in arrival orderNoSimple batch systems; easy to implementConvoy effect; high average waiting time
SJF (Shortest Job First)Among arrived processes, run the one with the shortest total burstUsually noMinimum average waiting time among non-preemptive policiesNeeds to know burst in advance; long jobs can starve
SRTF (Shortest Remaining Time First)Preempt as soon as a newly arrived job has a shorter remaining timeYesOptimal average waiting time of all the aboveMany context switches; starvation of long jobs
Round RobinEach process gets at most one quantum, then goes to the tail of the ready queueYesTime-sharing; fairness and good response timeAverage waiting time worse than SJF; overhead grows as quantum shrinks
PriorityRun the highest-priority ready processEitherReal-time and important-system tasksLow-priority processes starve — fixed by aging
Multilevel QueueSeparate fixed queues (system, interactive, batch) each with its own algorithmUsually between queuesClassifying processes permanentlyInflexible; a process cannot change queue
Multilevel Feedback QueueQueues with rules that move a process up or down based on its behaviourYesGeneral-purpose OS; approximates SJF without knowing burstsComplex to tune parameters

Round Robin — the two things that decide everything

  • If the quantum is very large (larger than every burst), RR degenerates into FCFS.
  • If the quantum is very small, context-switch overhead dominates and throughput collapses.
  • Rule of thumb: keep the quantum much larger than the context-switch time; typical values are 10–100 ms.

Aging

The remedy for starvation in priority scheduling: gradually increase the priority of a process that has waited a long time, so it eventually reaches the head of the queue.

Verification noteThe May–June 2017 paper asks “what advantage is there in having different time-quantum sizes at different levels of a multilevel queuing system”. Answer: processes that need more servicing time should sit in a lower-priority queue with a larger quantum, so the scheduling overhead per unit of useful work is smaller, while interactive processes in the top queue keep a short quantum and therefore a fast response.

Unit I Preparation Checklist

Track

Ticks are saved in this browser and survive a refresh. Progress also feeds the dashboard.