Unit 1: Introduction to Operating System [2 Hours]
This unit introduces the operating system as the most fundamental software layer in any computing device. It covers how OSes evolved, what problems they solve, how they are classified, and what they actually do inside a machine. These concepts form the vocabulary for every OS topic that follows — missing this unit makes later chapters harder to follow.
1.1 History and Generation of Operating System
Core Definition
The history of operating systems traces the evolution of software that manages hardware and runs programs — from bare-machine batch processing in the 1950s to the real-time, networked, and mobile OSes used today.
Before operating systems existed, programmers had to directly control hardware using machine code. Each new machine was programmed from scratch, with no reuse and no automation. Gradually, software layers were built to handle repetitive tasks, and those layers became what we now call the OS.
Detailed Explanation
OS history is typically divided into four generations, each solving the problems left by the previous one:
Generation 1 (1940s–early 1950s) — Vacuum Tubes, No OS:
Computers like ENIAC used vacuum tubes and had no software layer at all. Programmers physically wired circuits and used punched cards or paper tape. One program ran at a time, and the entire machine was dedicated to one user. If the program crashed, the entire machine stopped.
Generation 2 (mid-1950s–1960s) — Transistors and Batch Systems:
Transistors replaced vacuum tubes, making machines smaller and more reliable. Batch processing systems were introduced: jobs were collected in groups (batches), submitted together, and run one after another automatically by a simple monitor program. This monitor is considered the first primitive OS. Idle CPU time was reduced, but users still had no interaction with their running program.
Generation 3 (1960s–1980s) — Integrated Circuits and Multiprogramming:
Integrated circuits (ICs) allowed multiple programs to be loaded into memory simultaneously. The OS switched between jobs when one was waiting for I/O, keeping the CPU busy. This is multiprogramming. Time-sharing systems also emerged — the CPU was sliced into short time intervals and shared among multiple users interactively. UNIX was born during this era.
Generation 4 (1980s–present) — Personal Computers and Distributed Systems:
LSI and VLSI chips enabled affordable PCs. OSes like MS-DOS, then Windows and macOS, brought computing to homes. Networks emerged, leading to distributed OSes that manage multiple machines as one. Mobile, embedded, and real-time OSes continue to evolve today.
Let's Break It Down
Picture a single printer at a college. In Generation 1, only one student could use the entire computer lab to print one file. Generation 2 let a lab assistant collect 10 print jobs and send them in a batch — less idle time, but no live interaction. Generation 3 allowed 20 students to send print requests simultaneously, with the OS deciding who prints next. Generation 4 is your phone wirelessly sending a print job to a shared network printer from across campus. Each generation solved the same core problem: how to use the machine more efficiently without wasting resources.
Summary
- Generation 1: no OS, direct hardware control via vacuum tubes and wired circuits.
- Generation 2: batch systems and a monitor program — the first OS concept, no user interaction during execution.
- Generation 3: multiprogramming and time-sharing; UNIX era; CPU kept continuously busy.
- Generation 4: personal computers, GUIs, distributed and mobile OSes.
One-Liner Revision
OS history moves from bare hardware with no software layer (1940s) to real-time, distributed, mobile systems (present), with each generation solving idle CPU time and user interaction problems.
1.2 Introduction to Operating System
Core Definition
An operating system (OS) is system software that acts as an interface between the user and the computer hardware, managing hardware resources and providing a controlled environment in which application programs can execute.
Without an OS, every application would need to speak the hardware's own language — managing memory addresses, disk sectors, and processor registers manually. The OS takes all of that off the table so that application developers only think about functionality, not hardware details.
Detailed Explanation
The OS sits between two layers:
- Below it: physical hardware — CPU, RAM, disk drives, I/O devices.
- Above it: user applications — browsers, editors, games, compilers.
When a user opens a file, the application sends a request to the OS. The OS checks permissions, finds the file on disk, loads its data into memory, and hands it back to the application. The application never touches the hardware directly.
Key responsibilities of an OS include process management, memory management, file system management, device management, and security. These are covered in detail under Functions (section 1.5) and Objectives (section 1.3).
The OS also defines the user interface — either a CLI (Command Line Interface) like bash, or a GUI (Graphical User Interface) like Windows Explorer. The user interacts with the OS; the OS interacts with the hardware.
Summary
- The OS is the software layer between applications and hardware.
- It provides a standardized interface so applications don't need to manage hardware directly.
- Core tasks: process, memory, file, device, and security management.
- Interfaces: CLI (text-based) and GUI (graphical).
One-Liner Revision
An OS is system software that bridges user applications and hardware, managing all resources so programs run reliably without controlling hardware directly.
1.3 Objectives of Operating System
Core Definition
The objectives of an operating system define the two core roles it is designed to fulfil: acting as a Resource Manager (allocating and controlling hardware resources among competing processes) and acting as an Extended Machine (hiding hardware complexity and presenting a simpler, more capable virtual machine to users and programs).
These two objectives together explain why an OS exists: one is inward-facing (managing the machine), and the other is outward-facing (making the machine usable).
Detailed Explanation
Objective 1 — Resource Manager:
A computer has finite resources: one CPU, limited RAM, one or a few disks, one screen. Multiple programs run simultaneously and all want these resources at the same time. The OS acts as the arbitrator — it decides which process gets the CPU next, how much memory each program receives, which I/O request is served first, and which user can access which file.
Resource management involves four major hardware categories:
- Processor (CPU) management: deciding which process runs and for how long (scheduling).
- Memory management: allocating RAM to processes, protecting one process's memory from another.
- I/O device management: controlling printers, keyboards, disks through device drivers.
- File management: organizing data on disks into files and directories, controlling access.
Without resource management, two programs could overwrite each other's memory, or one program could starve all others of CPU time — the system would crash or behave unpredictably.
Objective 2 — Extended Machine (Virtual Machine):
Raw hardware is extremely difficult to program. Disk drives require precise cylinder/track/sector addressing; memory uses physical addresses; the CPU requires binary instructions. The OS hides all of this and offers a cleaner abstraction: files instead of disk sectors, virtual addresses instead of physical RAM locations, system calls instead of hardware instructions.
This abstraction makes the computer an "extended machine" — it appears more capable and more user-friendly than the underlying hardware actually is. A programmer calling fopen("report.txt") in C never needs to know which disk block holds that file. The OS knows, and it handles the rest.
Let's Break It Down
Resource Manager: Imagine a shared hostel kitchen with one stove, one fridge, and six students all wanting to cook at dinner time. The OS is the hostel warden who assigns cooking time slots, locks certain shelves per person, and ensures no one monopolizes the stove.
Extended Machine: Now imagine the same kitchen where each student sees a personal virtual stove on their phone app — they just tap "fry egg" and it happens, without knowing whether the real stove is gas or electric, or which burner is being used. That abstraction layer is the Extended Machine objective.
Test Yourself
- What is meant by the OS as a "Resource Manager"? Give two examples of resources it manages.
- What does the Extended Machine objective achieve? Why is it useful for application programmers?
- If two processes try to write to the same memory address simultaneously, which OS objective prevents data corruption?
Answers:
1) The OS allocates and controls hardware resources among competing processes. Examples: CPU time (scheduling) and RAM allocation (memory management).
2) It hides hardware complexity behind clean abstractions (files, virtual addresses, system calls), letting programmers write applications without managing hardware directly.
3) The Resource Manager objective — specifically memory management, which gives each process a protected memory space.
Summary
- Resource Manager: the OS allocates CPU, memory, I/O, and files among competing processes fairly and safely.
- Extended Machine: the OS presents hardware abstractions (files, virtual memory, system calls) that hide complexity from users and developers.
- Both objectives work together: one keeps the hardware organized, the other makes it accessible.
One-Liner Revision
The OS has two objectives: Resource Manager (allocate hardware fairly among processes) and Extended Machine (hide hardware complexity behind clean abstractions).
1.4 Types of Operating System
Core Definition
Types of operating systems are the different categories into which OSes are classified based on how they handle users, processes, tasks, and timing constraints. Each type is designed for a specific use case and operating environment.
No single OS design fits every scenario — a real-time control system for a pacemaker has completely different requirements from a time-sharing university server.
Detailed Explanation
1. Batch Operating System:
Jobs are collected, grouped into batches, and processed sequentially without user interaction. A batch monitor reads jobs from a queue (punch cards historically, job files today) and runs them one by one. No user input is accepted during execution.
Use case: payroll processing, bank statement generation, large-scale report generation.
Limitation: if a job has an error, the user only finds out after the entire batch finishes — no live debugging.
2. Multiprogramming Operating System:
Multiple programs are loaded into memory simultaneously. When one program waits for I/O, the CPU switches to another program. The CPU stays busy at all times.
Key concept: CPU utilization increases dramatically because I/O wait time (which is slow) no longer idles the processor.
Limitation: no direct interaction with the user; scheduling complexity increases.
3. Time-Sharing (Multitasking) Operating System:
A direct evolution of multiprogramming. CPU time is divided into small slices (time quanta), and each active user/process gets a turn in rotation. Response time is short enough that each user feels like they have the computer to themselves.
Use case: university mainframes in the 1970s–80s, modern server systems.
UNIX is the canonical time-sharing OS.
4. Real-Time Operating System (RTOS):
Designed for environments where tasks must complete within a strict and guaranteed time limit (deadline). Divided into two subtypes:
- Hard RTOS: missing a deadline is a system failure (e.g., aircraft autopilot, pacemaker, anti-lock brakes).
- Soft RTOS: deadlines are important but occasional misses are tolerable (e.g., video streaming, online gaming).
5. Distributed Operating System:
Manages a collection of independent computers connected by a network, presenting them as a single unified system to the user. Data and processing are spread across multiple machines.
Use case: cloud computing platforms, distributed databases, Google's internal systems.
6. Network Operating System (NOS):
Provides services to computers over a network — file sharing, printer sharing, user authentication. Unlike a distributed OS, each machine still has its own local OS; the NOS adds network capabilities on top.
Use case: Windows Server, Novell NetWare.
7. Embedded Operating System:
Designed to run on hardware with very limited resources (memory, CPU speed, power). Permanently embedded into devices like routers, ATMs, smart TVs, washing machines, and medical devices.
Examples: FreeRTOS, VxWorks, QNX.
8. Mobile Operating System:
Optimized for smartphones and tablets — small screens, touchscreens, cellular connectivity, battery constraints, and app ecosystems.
Examples: Android (Linux kernel), iOS (XNU kernel).
Let's Break It Down
Think of a bus service. A batch OS is a bus that leaves only when it's completely full — everyone waits together and no one boards mid-route. Multiprogramming is the driver picking up passengers at one stop while others unload at another — no idle waiting. Time-sharing is a taxi rotating between six regular customers every 5 minutes each — everyone gets frequent service. RTOS is an ambulance that must reach the hospital in exactly 8 minutes — no exceptions. Distributed OS is a fleet of buses managed by one control center, acting as one large transport system even though they're physically separate vehicles.
Common Mistake
Students confuse multiprogramming with time-sharing. Multiprogramming switches between jobs only when one is blocked (waiting for I/O) — there is no fixed time slice. Time-sharing switches between jobs at regular clock intervals regardless of whether the current job is blocked. Time-sharing is built on top of multiprogramming principles but adds user interactivity.
Common Mistake
A Network OS and a Distributed OS are not the same. In a NOS, each machine is aware it is connecting to a network and runs its own independent OS. In a Distributed OS, the network of machines is hidden from the user — it appears to be a single system.
| Type | Key Characteristic | User Interaction | Typical Use Case |
|---|---|---|---|
| Batch | Jobs queued and run sequentially | None during execution | Payroll, reports |
| Multiprogramming | Multiple programs in memory; CPU switches on I/O wait | None | Early mainframes |
| Time-Sharing | CPU sliced into time quanta; rotates among users | Interactive | University servers, UNIX |
| Real-Time (Hard) | Guaranteed deadline compliance | Minimal | Pacemakers, aircraft |
| Real-Time (Soft) | Deadline preferred, occasional miss tolerated | Interactive | Video streaming, gaming |
| Distributed | Multiple machines appear as one system | Transparent | Cloud platforms |
| Network (NOS) | Network services added on top of local OS | Per-machine | Windows Server |
| Embedded | Resource-constrained, device-specific | None or minimal | ATMs, routers, appliances |
| Mobile | Touch-optimized, battery-aware, app ecosystem | Highly interactive | Smartphones, tablets |
Test Yourself
- What is the core difference between a batch OS and a time-sharing OS?
- Why would a pacemaker use a Hard RTOS instead of a general-purpose OS?
- Distinguish between a Distributed OS and a Network OS with one key example each.
Answers:
1) Batch OS collects and runs jobs sequentially with no user interaction during execution; time-sharing gives each user a CPU time slice in rotation, providing interactive response.
2) A Hard RTOS guarantees task completion within a strict deadline. A general-purpose OS prioritizes throughput and responsiveness but does not guarantee deadlines — in a pacemaker, a missed deadline means the patient's heart doesn't receive the correct signal.
3) Distributed OS: a cloud platform like Google Search that uses thousands of servers but appears as one unified service to the user. Network OS: Windows Server allows file and printer sharing across a local network while each client machine still runs its own Windows copy.
Summary
- Batch OS: no interaction, sequential job execution — good for bulk processing.
- Multiprogramming: multiple jobs in memory, CPU switches on I/O block — improves CPU utilization.
- Time-Sharing: CPU time sliced per user — provides interactivity and fast response.
- RTOS: hard deadlines (mission-critical) or soft deadlines (media, gaming).
- Distributed OS hides multi-machine architecture; NOS exposes it but adds sharing services.
- Embedded and Mobile OSes are specialized for constrained or touch-driven environments.
One-Liner Revision
OS types range from batch (no interaction, sequential) to real-time (strict deadlines) to distributed (multi-machine as one), each built for a different environment and set of user/system requirements.
1.5 Functions of Operating System
Core Definition
The functions of an operating system are the specific operational tasks it performs to manage hardware and software resources, ensure program execution, maintain security, and provide a usable interface to users and applications.
If the Objectives (section 1.3) describe what the OS is trying to achieve, the Functions describe how it actually does it — these are the mechanisms running under the hood every second the computer is on.
Detailed Explanation
1. Process Management:
The OS creates, schedules, suspends, resumes, and terminates processes (running programs). It maintains a Process Control Block (PCB) for each process, storing its state, registers, memory allocation, and priority. The CPU scheduler decides which process runs next using policies like Round-Robin, Priority Scheduling, or Shortest Job First.
Key operations: process creation (fork() in UNIX), scheduling, synchronization (preventing race conditions), and inter-process communication (IPC).
2. Memory Management:
The OS tracks which parts of RAM are in use and which are free. When a process needs memory, the OS allocates it; when the process terminates, the OS reclaims it. It protects each process's memory space from unauthorized access by other processes.
Techniques used: paging (dividing memory into fixed-size pages), segmentation (dividing by logical units), and virtual memory (using disk space as an extension of RAM so programs larger than physical RAM can still run).
3. File System Management:
The OS organizes data on storage devices into a hierarchical structure of files and directories. It handles file creation, deletion, reading, writing, renaming, and moving. It also enforces access permissions (read, write, execute) per user.
The OS maps file names to physical disk locations through a file allocation table or equivalent data structure (e.g., inode in UNIX/Linux).
4. Device Management (I/O Management):
Every peripheral (keyboard, mouse, printer, disk, network card) communicates through device drivers — small OS modules that translate general OS commands into device-specific signals. The OS queues I/O requests, manages data buffers, and handles device interrupts.
It uses spooling (e.g., print spooling) to hold output requests until the device is ready, so applications don't wait for slow devices.
5. Security and Protection:
The OS enforces boundaries between processes (no process can read another's memory without permission) and between users (authentication via login, authorization via permissions). It guards against unauthorized access, malware, and accidental data corruption.
Mechanisms: user account control, file permission bits (read/write/execute), process isolation, and encryption support.
6. User Interface Management:
The OS provides the interface through which users interact with the computer. This is either a Command Line Interface (CLI) — where the user types commands (e.g., bash, PowerShell) — or a Graphical User Interface (GUI) — where the user interacts with windows, icons, and menus (e.g., Windows, macOS, GNOME on Linux).
7. Network Management:
Modern OSes include network stacks that manage communication over TCP/IP and other protocols. This includes assigning IP addresses (via DHCP), managing sockets, routing packets, and enforcing firewall rules.
8. Error Detection and Handling:
The OS continuously monitors hardware and software for errors — bad memory sectors, disk read failures, arithmetic overflow in processes, and hardware faults. On detection, it can terminate the faulty process, log the error, or attempt recovery without crashing the entire system.
Memory Hook
Remember OS functions with PM-FD-SU-NE:
Process Management → Memory Management → File System → Device Management → Security → User Interface → Network Management → Error Handling
| Function | What the OS Does | Key Mechanism |
|---|---|---|
| Process Management | Creates, schedules, and terminates processes | PCB, CPU scheduler |
| Memory Management | Allocates/deallocates RAM; protects process memory | Paging, segmentation, virtual memory |
| File System Management | Organizes data into files/directories; enforces permissions | File allocation table, inodes |
| Device Management | Controls I/O hardware through drivers; handles interrupts | Device drivers, spooling, buffering |
| Security and Protection | Enforces access control; isolates processes | Permissions, authentication, process isolation |
| User Interface | Provides CLI or GUI for user interaction | Shell, window manager |
| Network Management | Manages network protocols, sockets, and firewall | TCP/IP stack, DHCP, sockets |
| Error Handling | Detects hardware/software faults; recovers or logs | Interrupt handlers, error logs |
Test Yourself
- What is a Process Control Block (PCB) and what information does it hold?
- How does virtual memory allow a program larger than physical RAM to run?
- What is spooling and which OS function uses it?
Answers:
1) A PCB is a data structure maintained by the OS for each process. It stores the process state (running, waiting, etc.), program counter, CPU registers, memory allocation details, and scheduling priority.
2) Virtual memory maps parts of a program onto disk. Only the currently needed pages are loaded into RAM; the rest stay on disk. The OS swaps pages in and out as needed, making the program behave as if it has more RAM than physically exists.
3) Spooling (Simultaneous Peripheral Operation On-Line) queues output requests (e.g., print jobs) in a buffer on disk so that applications can continue working instead of waiting for the slow device to finish. It is used by Device Management.
Summary
- Process Management: creates, schedules, and terminates processes using PCBs and scheduling algorithms.
- Memory Management: allocates RAM, protects memory boundaries, and uses virtual memory for programs exceeding physical RAM.
- File System Management: organizes storage into files and directories, controls access permissions.
- Device Management: uses device drivers, spooling, and buffering to control I/O hardware.
- Security: enforces authentication, permissions, and process isolation.
- User Interface, Network Management, and Error Handling round out the OS's operational scope.
One-Liner Revision
OS functions are the mechanisms it uses to manage processes, memory, files, devices, security, UI, networks, and errors — together delivering a safe, usable, and efficient computing environment.
Unit 1 — Whole Chapter Summary
Whole Chapter Summary
- History and Generations: OS evolved through four generations — from no software (vacuum tubes) to batch systems, multiprogramming, and modern distributed/mobile OSes. Each generation reduced idle CPU time and improved user accessibility.
- Introduction: The OS is the system software layer between hardware and applications, providing a standardized, hardware-independent environment for programs to run.
- Objectives — Resource Manager: Allocates CPU, memory, I/O, and file resources fairly and safely among competing processes.
- Objectives — Extended Machine: Hides hardware complexity through abstractions (files, virtual addresses, system calls) so programmers and users never deal with raw hardware.
- Types: Batch (sequential, no interaction), Multiprogramming (CPU stays busy on I/O wait), Time-Sharing (CPU sliced per user), RTOS (hard/soft deadlines), Distributed (multi-machine as one), NOS (network services), Embedded and Mobile (specialized environments).
- Functions: Process Management (PCB, scheduling), Memory Management (paging, virtual memory), File System, Device Management (drivers, spooling), Security, User Interface, Network Management, and Error Handling.
Last-Minute Revision Sheet
Last-Minute Revision Sheet
- OS = software layer between hardware and apps → manages resources, provides abstractions
- Gen 1 → vacuum tubes, no OS | Gen 2 → batch + monitor | Gen 3 → multiprogramming + UNIX | Gen 4 → PCs, distributed, mobile
- Resource Manager → allocates CPU/RAM/I/O/files among processes
- Extended Machine → hides hardware → presents files, virtual memory, system calls
- Batch → queue + sequential, no interaction | Multiprog → switch on I/O block | Time-Sharing → CPU sliced per user
- Hard RTOS → no deadline miss tolerated (pacemaker) | Soft RTOS → occasional miss okay (streaming)
- Distributed OS → many machines look like one | NOS → each machine aware, sharing added on top
- Process Mgmt → PCB + scheduler | Memory Mgmt → paging + virtual memory | File Mgmt → inodes + permissions
- Device Mgmt → drivers + spooling | Security → auth + isolation | UI → CLI or GUI | Error → detect + recover
- Spooling = buffer slow I/O (printing) so app doesn't wait
- PCB = per-process data structure: state + registers + memory + priority


