Key Takeaways
- The OS sits between hardware and applications — it manages CPU, memory, storage, and I/O on behalf of programs
- The kernel runs in privileged mode (ring 0); applications run in restricted user mode (ring 3)
- Processes are isolated execution environments — each gets its own virtual address space
- Virtual memory lets every process think it has more RAM than physically exists
- File systems (ext4, NTFS, APFS) organize storage and manage metadata like permissions and timestamps
An OS Manages Hardware So Applications Don't Have To
Without an operating system, every application would need to implement its own disk I/O, memory allocation, network communication, and display rendering from scratch. That's clearly not practical. The OS provides a shared, managed abstraction layer.
The OS has four core responsibilities:
- Process management — Creating, scheduling, and terminating processes. Ensuring processes don't interfere with each other.
- Memory management — Allocating RAM to processes, implementing virtual memory, protecting memory boundaries.
- File system management — Organizing data on storage devices, managing permissions, handling I/O requests.
- Device management — Abstracting hardware through drivers so applications don't need device-specific code.
The Kernel Is the Core of the OS
The kernel is the central component of any OS. It runs continuously in kernel mode (ring 0) — a privileged CPU execution mode that allows direct hardware access. Everything else, including the applications you use, runs in user mode (ring 3) where hardware access is restricted.
This separation is the fundamental security model of modern computing. When your browser wants to read a file, it can't just reach into the disk controller directly. It makes a system call — a controlled crossing point into kernel mode — the kernel validates the request and performs the operation.
Monolithic kernel — All OS services (file system, networking, device drivers) run in kernel space. Fast but large. Linux uses this. Microkernel — Minimal kernel (just process and memory management), everything else in user space. Slower IPC but more resilient. macOS/iOS uses a hybrid (XNU). Hypervisor — Special kernel that manages multiple virtual machines (VMs), each running their own OS.
Processes and Threads: The Units of Execution
A process is a running instance of a program. Each process gets its own isolated virtual address space — its memory is protected from other processes. Processes communicate through inter-process communication (IPC) mechanisms: pipes, sockets, shared memory, message queues.
A thread is an execution unit within a process. Threads in the same process share memory space and can communicate directly. This makes threads faster to create and communicate between — but bugs in one thread can corrupt memory for all threads in the process.
| Aspect | Process | Thread |
|---|---|---|
| Memory | Isolated address space | Shared address space |
| Creation overhead | High (copy address space) | Low (just a stack) |
| Communication | IPC (pipes, sockets, etc.) | Direct shared memory |
| Failure isolation | Process crash is isolated | Thread crash kills process |
| Context switch cost | Expensive | Cheaper |
Process states: New → Ready → Running → Waiting (blocked on I/O) → Terminated. The OS scheduler moves processes between states based on CPU availability and I/O completion.
CPU Scheduling: Deciding Who Runs When
Modern CPUs are fast enough that time-sharing creates the illusion of parallelism even on a single core. The scheduler decides which process runs, for how long, and in what order.
Common scheduling algorithms:
- Round Robin — Each process gets a fixed time quantum (say 10ms), then yields the CPU. Simple and fair. Used in interactive systems.
- Priority Scheduling — Higher-priority processes run first. Risk of starvation for low-priority processes. Mitigated by aging (gradually increasing priority).
- Completely Fair Scheduler (CFS) — Linux's default. Tracks "virtual runtime" for each process and schedules whoever has run least. Balances fairness and performance.
- Real-Time Scheduling — For embedded/RTOS systems where deadlines matter. Processes have hard or soft time constraints.
Memory Management and Virtual Memory
Every process needs memory. The OS manages allocation, protection, and deallocation through several mechanisms.
Virtual Address Space — Each process sees a contiguous, private address space (e.g., 0x0000 to 0xFFFF…FFFF on 64-bit). The OS maintains a page table mapping virtual addresses to physical RAM locations. The CPU's Memory Management Unit (MMU) performs the translation on every memory access.
Paging — Memory is divided into fixed-size blocks called pages (typically 4KB). Virtual pages map to physical frames. Pages not in RAM are swapped to disk (swap space or page file). When a process accesses a swapped-out page, a page fault occurs — the OS brings the page back into RAM.
Memory Layout of a Process:
- Text segment — Read-only compiled code
- Data segment — Initialized global/static variables
- BSS segment — Uninitialized global variables
- Heap — Dynamically allocated memory (malloc/new), grows upward
- Stack — Function call frames, local variables, grows downward
File Systems: How Storage Is Organized
A file system organizes raw storage (disk blocks) into files and directories with metadata: names, permissions, timestamps, sizes, and pointers to data blocks.
| File System | OS | Max File Size | Key Features |
|---|---|---|---|
| ext4 | Linux | 16TB | Journaling, widely supported, stable |
| NTFS | Windows | 16EB | Permissions, encryption, journaling |
| APFS | macOS/iOS | 8EB | Copy-on-write, snapshots, SSD-optimized |
| Btrfs | Linux | 16EB | Snapshots, RAID, checksums, modern |
| ZFS | FreeBSD/Linux | 16EB | Integrity checksums, RAID-Z, pooled storage |
The OS implements a Virtual File System (VFS) layer — an abstraction that lets the same system calls (open, read, write, close) work across different underlying file systems. Your application doesn't know if it's reading from ext4 or NTFS.
Linux vs Windows vs macOS: Core Differences
| Aspect | Linux | Windows | macOS |
|---|---|---|---|
| Kernel | Linux (monolithic) | Windows NT | XNU (hybrid Mach + BSD) |
| Open source | Yes | No | Partial (Darwin) |
| Default file system | ext4 | NTFS | APFS |
| Shell | bash/zsh | PowerShell/CMD | zsh |
| Primary use case | Servers, embedded, dev | Desktop, enterprise | Creative, developer desktop |
| Package management | apt/yum/pacman | winget/Chocolatey | Homebrew |
Learn OS Fundamentals and Systems Programming at Precision AI Academy
Our bootcamp covers Linux administration, system internals, and the programming skills that make you dangerous at any level of the stack. Five cities, October 2026.
Frequently Asked Questions
What does an operating system actually do?
An OS manages CPU time, memory, storage, and I/O devices on behalf of applications. It provides a security boundary between processes and hardware through kernel mode/user mode separation.
What is the difference between kernel mode and user mode?
Kernel mode (ring 0) allows direct hardware access. User mode (ring 3) is restricted — applications must request services through system calls, which the kernel validates before executing.
What is virtual memory and why does it matter?
Virtual memory gives each process the illusion of a large, private address space. Pages not in RAM are stored on disk and loaded when needed. This enables running more programs than physical RAM would allow and isolates processes from each other.