What Is an Operating System?
Your computer is that airport. The CPU, RAM, disk, keyboard, printer are runways and gates. Programs (browser, editor, games) are the planes. The Operating System is the control tower — deciding who runs when, who gets memory, who talks to the printer, and who must wait.
That is the entire job of an OS: orchestrating shared hardware among competing programs, safely and fairly.
Formally (Galvin): an Operating System is a program that acts as an intermediary between a user of a computer and the computer hardware. Its purpose is to provide an environment in which a user can execute programs in a convenient and efficient manner.
The Three Views of an Operating System
User view — a friendly interface that makes the machine usable. System view — a resource allocator that manages CPU, memory, I/O. Goal view — a control program that prevents errors and improper use. All three describe the same OS from different angles.
Where the OS Sits — The Four-Layer View
A computer system can be divided into four layers. The OS sits squarely in the middle, shielding users and applications from the raw complexity of hardware.
Animated Architecture — The Four Layers in Motion
Because the OS sits between apps and hardware, you can run the same Chrome
binary on machines with different CPUs and disks. The OS hides those differences
behind uniform system calls like read(),
write(), fork(). Change the hardware — the OS adapts;
apps never notice.
OS Structure — How the Kernel Is Organised
Not every OS is built the same way internally. Galvin lists four dominant structural designs, each representing a different trade-off between simplicity, performance, and reliability.
Animated Comparison — Four Kernel Structures
lsmod. Load a new one with sudo modprobe <name>. Unload with sudo rmmod <name>.
# Linux — see all loaded kernel modules right now
$ lsmod | head -10
Module Size Used by
nvidia_drm 77824 4
nvidia_modeset 1339392 6 nvidia_drm
nvidia 62492672 308 nvidia_modeset
snd_hda_intel 61440 2
btusb 73728 0
bluetooth 1257472 49 btusb
uvcvideo 139264 0
xhci_pci 24576 0
ext4 962560 1
# Get info about one module
$ modinfo ext4 | head
filename: /lib/modules/6.5.0/kernel/fs/ext4/ext4.ko
license: GPL
description: Fourth Extended Filesystem
OS Operations — What the OS Does at Runtime
Modern operating systems perform four fundamental operational patterns. Understanding these is understanding why multitasking, security, and interrupts exist.
4.1 Dual-Mode Operation — The Hardware-Enforced Boundary
Without dual mode, a buggy user program could overwrite kernel memory, halt the CPU, or read another user's data. The hardware-enforced mode bit is what turns a computer from a toy into a multi-user, multi-tasking machine.
4.2 Multiprogramming, Multitasking & Timesharing
4.3 Interrupts & Traps — The Heartbeat of an OS
| Asynchronous — arrives any time |
| Raised by external device (disk done, packet arrived, timer) |
| User process is preempted involuntarily |
| Kernel runs the matching ISR |
| Synchronous — happens on a specific instruction |
| Caused by user code (syscall, divide by 0, invalid access) |
| User process explicitly asks the kernel |
| Kernel runs the matching handler |
4.4 System Calls — The Only Legal Door
# Linux — trace every system call a program makes
$ strace -c ls
# Kernel entries per syscall type
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
24.11 0.000123 7 17 mmap
18.63 0.000095 5 18 openat
12.55 0.000064 3 18 close
11.37 0.000058 3 16 read
9.02 0.000046 2 18 fstat
------ ----------- ----------- --------- --------- ----------------
100.00 0.000510 140 0 total
The Six Core Components of an Operating System
Galvin organises OS functionality into six major management subsystems. Every task the OS performs falls under one of these six.
Animated Overview — Six Managers Serving One Kernel
ps, top, kill.free -h.df -h.lsblk, iostat.chmod, sudo.Component Deep-Dive with Examples
6.1 Process Management in Action
# Running processes with PID, CPU%, MEM%, state
$ ps -eo pid,user,%cpu,%mem,state,comm --sort=-%cpu | head -6
PID USER %CPU %MEM S COMMAND
2841 mohit 34.2 8.1 R chrome
1923 mohit 12.7 4.5 S code
1105 root 3.4 1.2 S systemd
2201 mohit 2.1 0.9 S gnome-shell
845 root 0.8 0.3 S sshd
# State column: R=Running, S=Sleeping, D=Uninterruptible, Z=Zombie
Animated Process States — The Five-State Model
6.2 Memory Management — The Virtual Memory Illusion
# Inspect real memory usage
$ free -h
total used free shared buff/cache available
Mem: 15Gi 6.2Gi 2.1Gi 412Mi 7.3Gi 8.4Gi
Swap: 4.0Gi 128Mi 3.9Gi
6.3 File System — Everything Is a File (UNIX Philosophy)
# List files with permission bits, owner, size
$ ls -l /etc/passwd
-rw-r--r-- 1 root root 3021 Jul 18 09:14 /etc/passwd
# Decode the 10 permission characters:
# - rw- r-- r--
# │ │ │ └─ Others: read only
# │ │ └────── Group: read only
# │ └─────────── Owner: read + write
# └──────────────── Type: - regular, d dir, l link, c char, b block
6.4 Protection & Security — Users, Groups, Privileges
| Concept | Purpose | Linux Example |
|---|---|---|
| Authentication | Verify who you are | login, PAM, /etc/shadow |
| Authorisation | Control what you can do | File permissions, sudo, capabilities |
| Audit | Record what happened | /var/log/auth.log, journalctl |
| Isolation | Separate processes / users | Address spaces, namespaces, containers |
Types of Operating Systems — Quick Comparison
| Type | Purpose | Example | Use Case |
|---|---|---|---|
| Batch OS | Runs job queues without user interaction | IBM OS/360 | Payroll, billing |
| Time-Sharing | Many users on one machine | UNIX, Multics | Servers, mainframes |
| Distributed OS | Coordinates many networked computers | Amoeba, Plan 9 | Data centres, clusters |
| Real-Time OS | Hard deadline guarantees | VxWorks, QNX, FreeRTOS | Avionics, ABS brakes, robotics |
| Embedded OS | Tiny footprint, dedicated device | Contiki, TinyOS | Smart bulbs, sensors |
| Mobile OS | Touch UI, power efficiency | Android, iOS | Phones, tablets |
Practical — What Happens When You Type ls
fork() — a system call — to create a child process.
execve("/bin/ls"). Kernel loads the ls binary from disk via the file system, sets up its memory pages.
getdents() to read directory entries — kernel talks to the disk driver.
write(1, buf, len). Kernel forwards bytes to the terminal driver, which paints the pixels.
_exit(0). Kernel reclaims memory, notifies the parent shell via SIGCHLD, and the prompt returns.
Process (fork/exec), Memory (loading pages), File system (finding /bin/ls),
Storage (block reads), I/O (keyboard + terminal), Protection (checking your UID
against directory permissions). One command exercises the entire OS.
Golden Rules — Foundations to Remember
strace, top, free, lsof, dmesg. Every one of these is a window into a subsystem Galvin describes.