OPERATING SYSTEM
Complete Notes for Competitive Exams
Topics Covered
History of OS • Simple Batch Systems • Multi-programmed Batch Systems
Time Sharing Systems • Personal Computer Systems • Distributed Systems
Real-Time Systems • OS Structures • Command Interpreter System
OS Services • System Calls • System Programs
Detailed explanations with real-world examples | Exam-focused key points
1. HISTORY OF OPERATING SYSTEM
1.1 What is an Operating System?
An Operating System (OS) is system software that acts as an intermediary between the user and the computer
hardware. It manages hardware resources and provides an environment for application programs to run. The OS
is responsible for making the computer convenient to use and using the hardware efficiently.
Example: When you open a browser, the OS allocates RAM, CPU time, and network access to it. You don't
manually manage these — the OS does it transparently.
1.2 Evolution / Generations of OS
Generation Era Technology OS Type
1st 1940s-1950s Vacuum Tubes No OS — manual wiring
2nd 1955-1965 Transistors Batch Processing OS
3rd 1965-1980 ICs (Integrated Circuits) Multiprogramming, Time-sharing
4th 1980-Present VLSI Chips Personal Computer OS, GUI
5th 1990-Present Mobile/Network Distributed, Mobile OS
1.3 Goals of OS
• Convenience: Makes computer easy to use. Example: GUI allows users to click icons instead of typing
commands.
• Efficiency: Ensures proper utilization of CPU, memory, I/O devices. Example: CPU scheduling prevents
CPU from sitting idle.
• Ability to Evolve: OS must be designed so new features can be added without disrupting existing services.
Exam Key Point: OS acts as a resource manager (CPU, memory, I/O) and as an extended machine (provides
easy interface to user).
2. SIMPLE BATCH SYSTEMS
2.1 Concept
In the 1950s-60s, the first OS was a Simple Batch System. Users submitted jobs (programs + data) on punch
cards to a computer operator. The operator grouped similar jobs into batches and fed them to the computer. The
OS loaded each job automatically and ran them one by one without user interaction.
2.2 Working of Simple Batch System
1. User submits a job (written on punch cards or magnetic tape).
2. Operator collects similar jobs and places them in a batch.
3. Batch is loaded into memory; OS reads and executes each job sequentially.
4. Output is collected and returned to the user.
Real-World Example: A payroll system in the 1960s — all employee punch cards were gathered, processed
overnight as a batch, and salary slips printed the next morning.
2.3 Resident Monitor
The Resident Monitor is the small OS program that always stays in memory. It contains: (i) Sequence Processor
— reads control cards and directs job execution; (ii) Loader — loads programs into memory; (iii) Control Card
Interpreter — interprets special control instructions like $JOB, $RUN, $END.
2.4 Advantages and Disadvantages
Advantages Disadvantages
Reduced setup time between jobs No interaction between user and job
CPU was used more efficiently than manual systems If a job fails, remaining batch is affected
Operator intervention minimized CPU is often idle waiting for I/O (poor utilization)
Simpler job scheduling Slow turnaround time for users
Key Exam Fact: Simple Batch Systems had a major problem — CPU was idle during I/O operations. This led to
the concept of Multiprogramming.
3. MULTI-PROGRAMMED BATCH SYSTEMS
3.1 Need for Multiprogramming
In Simple Batch Systems, when a job waited for I/O, the CPU sat idle. Multiprogramming was introduced to keep
the CPU busy by loading multiple jobs into memory at once. When one job waits for I/O, the OS switches the
CPU to another job.
3.2 How Multiprogramming Works
Example: Suppose 3 jobs J1, J2, J3 are in memory. J1 starts and uses the CPU. When J1 requests disk I/O,
instead of waiting, the OS gives the CPU to J2. When J2 waits for a printer, CPU goes to J3. By the time J3
finishes, J1's I/O may be complete — so the CPU returns to J1. The CPU is almost always busy!
Feature Simple Batch Multiprogrammed Batch
Jobs in memory 1 at a time Multiple jobs simultaneously
CPU idle time High (during I/O) Low (switches between jobs)
Memory management Simple Complex (partition/paging)
Throughput Low High
Complexity Low High
3.3 Requirements of Multiprogramming
• I/O Routine in OS: OS must handle I/O on behalf of user programs.
• Memory Management: OS must allocate memory to multiple jobs safely.
• CPU Scheduling: OS must decide which job gets the CPU next.
• Deadlock Handling: Prevent situations where jobs wait for each other forever.
4. TIME SHARING SYSTEMS
4.1 Concept
Time Sharing (also called Multitasking) is a logical extension of multiprogramming. The CPU switches between
multiple jobs so rapidly (in time slices / quantum — typically 10-100ms) that each user gets the impression of
having a dedicated computer. Multiple users can interact with the computer simultaneously.
Example: A university's mainframe with 30 students — each student types commands on their terminal. The OS
gives each student 50ms of CPU time in rotation. Since 50ms feels instantaneous to humans, everyone thinks they
have exclusive use of the machine.
4.2 Key Characteristics
• Response Time: Usually less than 1 second — user gets quick feedback.
• Interactive: User can interact with programs in real-time (give input, see output immediately).
• Time Slice / Quantum: Fixed time unit given to each process. If process doesn't finish, it's preempted and
put back in queue.
• CPU Scheduling: Round Robin scheduling is most common — each process gets equal turns.
• Swapping: If a process is not in memory, it is swapped in from disk when its turn comes.
4.3 Comparison: Batch vs Time-Sharing
Parameter Batch System Time-Sharing System
User interaction None Continuous (interactive)
Response time Hours/days Seconds
Number of users One at a time Multiple simultaneously
CPU scheduling FCFS Round Robin
Use case Payroll, billing Terminals, IDEs, servers
Key Exam Point: CTSS (Compatible Time Sharing System, MIT 1961) was the first time-sharing OS. UNIX is the
most famous time-sharing OS. Time sharing = multiprogramming + user interaction.
5. PERSONAL COMPUTER SYSTEMS
5.1 Introduction
In the 1970s-80s, with the advent of microprocessors (like Intel 8080), computers became affordable for
individuals. A Personal Computer (PC) is dedicated to a single user. The OS for PCs was designed for
convenience and ease of use rather than maximum resource utilization.
5.2 Characteristics of PC OS
• Single user at a time (in early systems like MS-DOS).
• GUI (Graphical User Interface) — e.g., Windows, macOS — icons, menus, mouse interaction.
• No need for complex memory protection (only one user).
• Borrowed concepts from mainframe OS but simplified them.
• Modern PC OS (Windows 10/11, Linux) support multitasking and multi-user.
Example: MS-DOS (1981) — single-user, single-tasking. Windows 95 added multitasking. macOS/Linux are
multi-user, multitasking modern PC OS.
5.3 Evolution of PC OS
Year OS Key Feature
1981 MS-DOS Command-line, single-tasking
1984 Apple Macintosh OS First commercial GUI
1985 Windows 1.0 GUI on top of DOS
1991 Linux (Kernel) Open-source Unix-like OS
2001 Windows XP Stable, user-friendly
2001 Mac OS X Unix-based macOS
2015 Windows 10 Universal platform
6. DISTRIBUTED SYSTEMS
6.1 Definition
A Distributed System consists of a collection of autonomous computers linked by a network and distribution
middleware. To the user, the system appears as a single coherent system. Each computer has its own CPU,
memory, and OS, but they work together to achieve common goals.
Example: Google's search engine runs on thousands of servers spread across data centers worldwide. When you
search, queries are processed by many machines in parallel — but it feels like one fast system to you.
6.2 Advantages of Distributed Systems
• Resource Sharing: Files, printers, databases, and processors can be shared across machines.
• Computation Speedup: Tasks can be split into subtasks and run in parallel (load balancing).
• Reliability/Fault Tolerance: If one machine fails, others continue — no single point of failure.
• Communication: Users can communicate via email, file sharing, messaging across the network.
• Scalability: Add more machines to increase capacity easily.
6.3 Types of Distributed Systems
• Client-Server: Clients request services; servers provide them. Example: Web browser (client) and web
server.
• Peer-to-Peer (P2P): All nodes are equal, can act as both client and server. Example: BitTorrent.
• Cluster Computing: Tightly coupled machines for high performance. Example: Beowulf clusters for scientific
computing.
• Cloud Computing: Resources provided over internet on-demand. Example: AWS, Azure, Google Cloud.
Key Exam Point: Distributed OS vs Network OS — Distributed OS hides the network; users don't know which
machine runs their task. Network OS requires users to explicitly log into remote machines.
7. REAL-TIME SYSTEMS
7.1 Definition
A Real-Time Operating System (RTOS) is designed to serve real-time applications that process data as it comes
in, within a strict time deadline. The correctness of the system depends not only on the logical result but also on
the time at which results are produced.
7.2 Types of Real-Time Systems
Hard Real-Time Systems:
Missing a deadline is a catastrophic failure. The system MUST respond within the guaranteed time.
Examples: Air traffic control systems, nuclear reactor control, anti-lock braking system (ABS) in cars, pacemakers,
missile guidance systems, surgical robots.
Soft Real-Time Systems:
Missing a deadline is undesirable but not catastrophic. The system tries to meet deadlines but can tolerate
occasional misses.
Examples: Video streaming (occasional frame drop is acceptable), online gaming, digital audio/video systems,
ATM machines.
7.3 Characteristics of RTOS
• Deterministic: Response time must be predictable and guaranteed.
• Preemptive Priority Scheduling: Higher-priority tasks immediately preempt lower-priority ones.
• Small Kernel: Minimal overhead to ensure fast response.
• No Virtual Memory: Disk paging would introduce unpredictable delays.
• Minimal Interrupt Latency: Very fast interrupt handling.
Feature Hard Real-Time Soft Real-Time
Deadline miss System failure Performance degradation
Examples Pacemaker, ABS, nuclear reactor Video streaming, ATM
Predictability 100% guaranteed Best-effort
Used in Safety-critical systems Multimedia, consumer apps
8. OPERATING SYSTEM STRUCTURES
8.1 Simple / Monolithic Structure
The entire OS is written as a single, large program. All OS functions (file system, I/O, memory management, CPU
scheduling) are combined into one kernel with no clear separation.
Example: MS-DOS was structured with minimal separation between hardware and application layers. If one
component crashed, the entire system could crash.
• Advantage: Fast (direct calls, no overhead) • Disadvantage: Hard to maintain, debug; a bug crashes the
whole system.
8.2 Layered Approach
The OS is divided into a hierarchy of layers. Layer 0 is hardware; the highest layer is the user interface. Each
layer only uses services from the layer directly below it.
Layer 5 (Top) User Programs
Layer 4 User Interface (Shell)
Layer 3 I/O Management
Layer 2 Memory Management
Layer 1 CPU Scheduling
Layer 0 (Bottom) Hardware
Example: THE Operating System (Dijkstra 1968) used layered structure. Advantage: Easy debugging — test one
layer at a time. Disadvantage: Overhead from passing calls through layers.
8.3 Microkernel Structure
Only the most essential functions are kept in the kernel (IPC, basic memory management, basic scheduling). All
other services (file system, device drivers, network protocols) run in user space as separate processes.
Example: macOS/iOS kernel (XNU), Windows NT, QNX, MINIX 3. If a device driver crashes, it doesn't crash the
OS — the driver process simply restarts.
8.4 Modular Kernel (Modern Approach)
The kernel has a set of core components and dynamically loads additional modules as needed. This combines
the best of monolithic (performance) and microkernel (extensibility) approaches.
Example: Linux kernel — core kernel runs efficiently; drivers and file systems are loadable modules (you can add a
new filesystem driver without rebooting). Solaris also uses this approach.
Structure Kernel Size Performance Reliability Example
Simple/Monolithic Very Large High Low MS-DOS, early UNIX
Layered Large Medium Medium THE, Windows NT layers
Microkernel Very Small Lower (IPC overhead) High Mach, QNX, MINIX
Modular Medium High High Linux, Solaris
9. COMMAND INTERPRETER SYSTEM
9.1 Definition
A Command Interpreter (also called Shell or Command Line Interface — CLI) is the program that reads and
executes commands typed by the user. It acts as the interface between the user and the OS kernel. When a user
logs in, the command interpreter is started automatically.
9.2 Types of Shells
• Bourne Shell (sh): Original Unix shell by Stephen Bourne (1979). Basic scripting.
• C Shell (csh): C-like syntax. Introduced aliases and history. BSD Unix.
• Bourne Again Shell (bash): Most popular Linux shell. Enhanced sh with scripting features.
• Korn Shell (ksh): Combines features of sh and csh. Used in commercial UNIX.
• Z Shell (zsh): Extended bash with themes, plugins. Default on macOS Catalina+.
• Windows CMD: Command Prompt in Windows. Limited scripting via batch files.
• PowerShell: Modern Windows shell with .NET integration and powerful scripting.
9.3 How Command Interpreter Works
1. User types a command (e.g., ls -l).
2. Shell reads the command and parses it (splits into command + arguments).
3. Shell searches for the command in directories listed in PATH variable.
4. If found, shell calls the OS (via system call exec()) to run the program.
5. Program executes and output is displayed to user.
6. Shell prompts for next command.
Example Commands: ls -la (List all files with details) | mkdir projects (Create directory) | cp [Link] backup/ (Copy
file) | kill -9 1234 (Kill process 1234)
9.4 Two Approaches to Implement Commands
Approach 1 — Built-in Commands: The command code is inside the shell itself. Fast but makes the shell large.
Example: cd, echo, pwd in bash are built-in.
Approach 2 — External Programs: Each command is a separate program file stored in /bin or /usr/bin. The shell
just finds and executes these programs. Example: ls, cp, grep are external programs in /bin. This keeps the shell
small and allows easy addition of new commands.
Key Exam Point: The shell (command interpreter) is NOT part of the kernel — it's a user-level program. You can
even replace the default shell with another. bash is the most tested shell in competitive exams.
10. OPERATING SYSTEM SERVICES
10.1 Overview
The OS provides various services to programs and users. These services make programming easier and protect
users from hardware complexity. Services can be grouped into two categories: services that help users, and
services that ensure efficient system operation.
10.2 Services for Users
• Program Execution: OS loads a program into memory, runs it, and handles abnormal termination. Example:
Running a Java program — OS loads the JVM and your .class files.
• I/O Operations: Programs cannot directly access I/O devices. OS provides controlled access to files and
devices. Example: When you save a file in Word, the OS handles writing to disk.
• File System Manipulation: OS manages creating, reading, writing, deleting, and organizing files and
directories. Example: Windows Explorer operations are all handled by the OS file system service.
• Communications: OS supports process communication — both on the same machine (IPC) and across
networks (sockets). Example: Pipes in Linux (ls | grep txt) — OS connects output of ls to input of grep.
• Error Detection: OS monitors the CPU, memory, I/O devices, and user programs for errors and takes
appropriate action. Example: If a program divides by zero, OS sends a SIGFPE signal and may terminate it.
10.3 Services for Efficient System Operation
• Resource Allocation: When multiple users/jobs run simultaneously, OS allocates CPU, memory, I/O
devices, and files fairly. Example: CPU scheduler deciding which process runs next.
• Accounting/Logging: OS keeps track of which users use how much resource (CPU time, disk space) for
billing or analysis.
• Protection and Security: When multiple users share a system, OS ensures one user cannot interfere with
others. Security involves defending against external threats. Example: File permissions (chmod in Linux), user
authentication (login passwords).
11. SYSTEM CALLS
11.1 Definition
A System Call is the programmatic way a user application requests a service from the OS kernel. Since user
programs run in user mode (restricted access) and the kernel runs in kernel mode (full hardware access), system
calls provide a controlled entry point into the kernel.
Example: When a C program calls fopen('[Link]', 'r'), the C library translates this into an open() system call. The
CPU switches from user mode to kernel mode, the OS opens the file, then control returns to user mode.
11.2 How System Calls Work (Step-by-Step)
1. Application calls a library function (e.g., read() in C).
2. Library function places system call number in a CPU register.
3. Library executes a TRAP or INT instruction — causes a software interrupt.
4. CPU switches from User Mode to Kernel Mode.
5. OS looks up the system call number in the System Call Table.
6. OS executes the appropriate kernel routine.
7. Result is returned to the register; CPU switches back to User Mode.
8. Library function returns the result to the application.
11.3 Types of System Calls
Category Description Linux Examples Windows Examples
Process Control Create, terminate, wait for processes
fork(), exec(), exit(), wait() CreateProcess(), ExitProcess()
File Management Create, read, write, delete filesopen(), read(), write(), close() CreateFile(), ReadFile()
Device Management Request/release I/O devices ioctl(), read(), write() SetConsoleMode()
Information MaintenanceGet/set time, date, system infogetpid(), alarm(), sleep() GetCurrentProcessId()
Communications Message passing, shared memory
pipe(), socket(), send() CreatePipe(), socket()
Protection File permissions, access control
chmod(), chown(), umask() SetFileSecurity()
11.4 Important System Calls (Must Know for Exams)
• fork(): Creates a new child process (exact copy of parent). Child gets PID=0; parent gets child's PID. Used in
Unix/Linux.
• exec(): Replaces current process with a new program. Used with fork() to run a new program.
• exit(): Terminates a process and returns exit status to parent.
• wait(): Parent process waits for child to complete.
• open(): Opens a file and returns file descriptor.
• read()/write(): Read from / write to a file descriptor.
• socket(): Creates a network communication endpoint.
• pipe(): Creates an inter-process communication channel.
Key Exam Point: fork() creates a child process. After fork(), both parent and child continue from the same point.
fork() returns 0 to child, child's PID to parent, and -1 on failure. The typical fork-exec pattern: fork() to create
process, exec() to run a new program in it.
12. SYSTEM PROGRAMS
12.1 Definition
System Programs (also called System Utilities) provide a convenient environment for program development and
execution. They are different from the kernel — they are user-level programs that come with the OS and provide
commonly needed functions. The key distinction: System programs use system calls, but they are not system
calls themselves.
12.2 Categories of System Programs
• File Management: Programs to create, delete, copy, rename, print, list, and manipulate files and directories.
Examples: ls, cp, mv, rm, mkdir, chmod (Linux); Explorer, copy, del (Windows)
• Status Information: Query the system for date/time, memory status, disk space, number of users, CPU
usage.
Examples: top, ps, df, free, uptime (Linux); Task Manager, msinfo32 (Windows)
• File Modification: Text editors to create and modify file content.
Examples: vi, nano, gedit, Notepad, VS Code
• Programming Language Support: Compilers, assemblers, debuggers, and interpreters.
Examples: gcc (C compiler), javac (Java), gdb (debugger), python interpreter
• Program Loading and Execution: Loaders and linkers that load compiled programs into memory for
execution.
Examples: ld (GNU linker), loader built into OS
• Communications: Programs for creating virtual connections, sending messages, login to other systems.
Examples: ssh, ftp, telnet, mail, curl, wget
• Background Services (Daemons): Programs that run in the background, started at boot time, providing
services continuously.
Examples: httpd (web server), sshd (SSH daemon), cron (scheduler), mysqld (database)
Category Purpose Linux Example Windows Example
File Management Manage files/dirs ls, cp, rm Explorer, xcopy
Status Info System monitoring top, df, ps Task Manager
File Modification Edit files vi, nano Notepad
Language Support Compile/debug code gcc, gdb MSVC, WinDbg
Communication Network tools ssh, ftp PuTTY, WinSCP
Background Services Continuous services httpd, sshd, cron [Link], IIS
QUICK REVISION SUMMARY — EXAM CHEAT SHEET
Topic Key Point Important Example/Fact
History of OS OS evolved from no OS to distributed/mobile OS 1st
overGen:
generations
No OS; 4th Gen: PC OS; 5th Gen: Mobile OS
Simple Batch Jobs grouped in batches, run sequentially; Resident
Punch
Monitor
cardscontrols
era; CPUexecution
idle during I/O — major drawback
Multiprogrammed Batch Multiple jobs in memory; CPU switches to anotherCPU
job during
utilization
I/O increases dramatically
Time Sharing CPU switches rapidly giving illusion of dedicated machine
Round Robin
to each
scheduling;
user CTSS first time-sharing OS (1961)
PC Systems Single-user systems with GUI; evolved from CLI (DOS)
MS-DOS
to GUI
(1981) → Windows 10 (2015) → Windows 11
(Windows)
Distributed Systems Multiple autonomous computers appear as one toGoogle
user Search, Cloud Computing; Fault tolerant
Real-Time Systems Hard: deadline miss = failure; Soft: deadline missHard:
= degradation
Pacemaker, ABS; Soft: Video streaming
OS Structures Monolithic (fast, fragile), Layered (organized), Microkernel
Linux uses(reliable),
Modular;Modular
MINIX uses
(bestMicrokernel
of both)
Command Interpreter Shell reads and executes user commands; not part
bashof kernel
(Linux), cmd/PowerShell (Windows)
OS Services Execution, I/O, File mgmt, Communication, Error For
detection,
users +Resource
for system
allocation,
efficiencySecurity
System Calls User program's interface to OS kernel; causes mode
fork(),
switch
exec(),
fromopen(),
User to
read(),
Kernelwrite(),
modesocket()
System Programs User-level utilities providing development environment;
gcc, ls,NOT
top, kernel
ssh, cron
code
— all system programs
TOP EXAM QUESTIONS & ANSWERS
Q1: What is the difference between multiprogramming and multitasking?
Multiprogramming: multiple programs in memory; OS switches when one waits for I/O — maximizes CPU use.
Multitasking (Time-sharing): CPU switches rapidly between programs based on time slices, providing
interactive response to users.
Q2: What is the difference between process and program?
A program is a passive, static set of instructions stored on disk. A process is an active, dynamic execution of a
program — it has its own memory space, CPU state, and resources.
Q3: What is the role of the Resident Monitor?
The Resident Monitor is a small OS that stays permanently in memory in batch systems. It loads each job
automatically, interprets control cards ($JOB, $RUN, $END), and passes control to jobs one by one.
Q4: Difference between Hard and Soft Real-Time Systems?
Hard Real-Time: missing deadline = system failure (Pacemaker, ABS). Must be 100% predictable. Soft
Real-Time: missing deadline = performance degradation, not catastrophic (video streaming, online gaming).
Q5: What is the difference between system calls and system programs?
System calls are low-level kernel interfaces used by programs (fork, open, read). System programs are
user-level utilities that use system calls to provide services (ls uses open/read, gcc uses exec).
Q6: What is a microkernel? What are its advantages?
A microkernel keeps only essential functions in kernel space (IPC, basic scheduling, basic memory). All other
services run in user space. Advantages: More reliable (a crashed driver doesn't crash OS), more portable,
easier to extend. Disadvantage: Slower due to IPC overhead.
End of Operating System Notes | Best of luck for your exam!