How Operating Systems Work: The Complete Guide

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:

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.

Kernel Types
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.

AspectProcessThread
MemoryIsolated address spaceShared address space
Creation overheadHigh (copy address space)Low (just a stack)
CommunicationIPC (pipes, sockets, etc.)Direct shared memory
Failure isolationProcess crash is isolatedThread crash kills process
Context switch costExpensiveCheaper

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:

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:

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 SystemOSMax File SizeKey Features
ext4Linux16TBJournaling, widely supported, stable
NTFSWindows16EBPermissions, encryption, journaling
APFSmacOS/iOS8EBCopy-on-write, snapshots, SSD-optimized
BtrfsLinux16EBSnapshots, RAID, checksums, modern
ZFSFreeBSD/Linux16EBIntegrity 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

AspectLinuxWindowsmacOS
KernelLinux (monolithic)Windows NTXNU (hybrid Mach + BSD)
Open sourceYesNoPartial (Darwin)
Default file systemext4NTFSAPFS
Shellbash/zshPowerShell/CMDzsh
Primary use caseServers, embedded, devDesktop, enterpriseCreative, developer desktop
Package managementapt/yum/pacmanwinget/ChocolateyHomebrew

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.

$1,490 · October 2026 · Denver, LA, NYC, Chicago, Dallas
Reserve Your Seat

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.

BP
Bo Peng

Founder of Precision AI Academy. Software engineer with experience across Linux systems, cloud infrastructure, and AI development. Teaches practical tech skills to working professionals.