Operating System (OS)
1. Definition
An operating system is the system software that acts as an interface between the user (and the application programs) and the computer hardware, and as the resource manager that allocates the CPU, memory, storage and devices among programs. Without an OS, a computer is a heap of hardware that can do nothing useful; the OS is the first program that runs when the machine starts and the last that stops.
2. Where the OS Sits
┌───────────────────────────────────────────────────────────┐
│ USER (clicks, types commands, opens files) │
├───────────────────────────────────────────────────────────┤
│ APPLICATION SOFTWARE (browser, Word, compiler, games) │
├───────────────────────────────────────────────────────────┤
│ SYSTEM CALL INTERFACE (open, read, write, fork, exec) │
├───────────────────────────────────────────────────────────┤
│ OPERATING SYSTEM │
│ • KERNEL (process, memory, file, device management) │
│ • SCHEDULER, IPC, virtual memory, file system │
│ • DEVICE DRIVERS │
│ • SHELL / GUI (command interpreter, desktop) │
├───────────────────────────────────────────────────────────┤
│ HARDWARE (CPU, RAM, disks, NIC, keyboard, display) │
└───────────────────────────────────────────────────────────┘
| Part | Role |
|---|---|
| Kernel | Core that runs in privileged mode: processes, memory, files, devices, interrupts |
| Shell / GUI | User interface — command line (bash, PowerShell) or graphical desktop |
| System calls / API | The only legal doorway from user programs into the kernel |
| Device drivers | Code for each device, loadable as modules |
| Utilities & services | Formatting, backup, printing spooler, network services |
3. Functions of an Operating System
- Process management — create, schedule, synchronise, suspend and terminate processes; provide IPC; handle deadlock.
- Memory management — allocate/deallocate RAM, keep track of free and used areas, support virtual memory and paging/swapping.
- File management — create, open, read, write, delete, rename files; directory structure; access permissions; free-space management.
- Device (I/O) management — drive every peripheral through device drivers; handle interrupts, buffering, spooling, caching.
- Security and protection — authentication (passwords, biometrics), authorisation, user accounts, memory protection between processes.
- Networking — protocol stack, sockets, sharing of files and printers.
- Error detection and handling — detect and report hardware faults and program errors without crashing the machine.
- Job accounting and monitoring — track resource usage per user/process.
- Program execution and interface — load and run programs; give the user a CLI or GUI; provide utilities.
- Abstraction — hide hardware details behind simple names: a program says "write to file" instead of "toggle head 3, sector 42".
4. Kernel, User Mode and System Calls
- The CPU has at least two privilege levels: kernel (supervisor) mode, where every instruction and memory address is available, and user mode, where privileged instructions are blocked.
- A program requests a service by making a system call (
open(),read(),fork(),exec()), which traps into the kernel, switches to kernel mode, performs the work and returns the result. This mode switch is the mechanism that keeps one program from damaging others. - Kernel designs
- Monolithic — all services inside one kernel (Linux, traditional UNIX): fast, but a bug can crash everything.
- Microkernel — only essential services in the kernel, the rest as user processes (Minix, QNX): robust and flexible, with more message-passing overhead.
- Hybrid — mix of both (Windows NT family, macOS XNU).
- Modular / loadable modules — Linux's compromise: a monolithic kernel that can load drivers at run time.
- Monolithic vs microkernel in one line: monolithic trades safety for speed, microkernel trades speed for safety.
5. Types of Operating Systems (overview)
| Type | Key idea |
|---|---|
| Batch | Jobs grouped and run one after another without user interaction |
| Multiprogramming | Several jobs kept in memory; CPU switches to another when one waits for I/O |
| Time-sharing (multitasking) | CPU time sliced among interactive users/processes; each feels alone |
| Multiprocessing | Two or more CPUs/cores working in parallel on the same system |
| Real-time (RTOS) | Guaranteed response within a deadline; hard vs soft real time |
| Distributed | Several independent computers appear as one system |
| Network OS | Manages and shares resources over a network (file/print servers) |
| Embedded / mobile | Small footprint for appliances, phones, IoT devices (Android, iOS, FreeRTOS) |
| Cluster / cloud | Many machines cooperating for high availability and scale |
6. Popular Operating Systems
| OS | Family | Notes |
|---|---|---|
| Windows 10/11, Windows Server | Proprietary, hybrid kernel | Largest desktop share; Win32/.NET APIs; NTFS |
| Linux (Ubuntu, Fedora, Debian, RHEL) | Open source, monolithic kernel | Server/cloud/supercomputer dominance; ext4, shell power |
| macOS | Proprietary, UNIX-based (Darwin/XNU) | Mac hardware; APFS; excellent for creative work |
| Android | Linux kernel + Java/Kotlin APIs | World's most used mobile OS |
| iOS | UNIX-based (Darwin) | Apple mobile devices, closed ecosystem |
| UNIX (Solaris, AIX, HP-UX) | Proprietary UNIX | Enterprise servers, high reliability |
| FreeRTOS, VxWorks, QNX | RTOS | Embedded control: cars, medical, industrial |
7. Why an OS is Necessary
- Convenience — the user gets files, windows, printers and programs instead of registers and tracks.
- Efficiency — the CPU, memory and devices are shared and kept busy; no resource sits idle while another is overloaded.
- Ability to evolve — new hardware is supported by writing a driver, without changing applications.
- Protection — one faulty or malicious program cannot corrupt another program or the system.
- Multiuser and multiprogramming support — many users and many programs safely coexist.
8. Exam Points
- Define an operating system. Explain its role as resource manager and as an interface — 5-7 marks, almost certain.
- Explain the functions of an OS (any five, in detail) — 5-7 marks, very frequent.
- Draw the layered diagram: user → application → system calls → kernel → hardware — 5 marks.
- What is the kernel? Differentiate monolithic and microkernel designs — 5 marks.
- What is a system call? Why is a mode switch needed? — 3-5 marks.
- List the types of OS with one line each (batch, time-sharing, real-time, distributed, multiprocessing) — 5 marks.
- Give any four examples of OS and state their family/type — 3 marks.