OPERATING SYSTEMS / OVERVIEW
From Hardware to Software — The Full Picture
Every layer of your computer, from electrons to the app you're running
EXPLANATION
Most people use a computer every day but never understand what actually happens when they press the power button or open a browser. This chapter tears down every layer of abstraction and rebuilds your mental model from the ground up. Your computer is not magic. It is electrons moving through silicon, governed by physics, organized by ingenious engineering into a hierarchy of abstractions. Each layer hides complexity from the layer above. The complete stack, bottom to top: ① Hardware — transistors, circuits, chips, silicon. The actual physical matter ② Microarchitecture — how transistors are organized into logic gates, then into CPUs ③ Instruction Set Architecture (ISA) — the contract between hardware and software ④ BIOS/UEFI Firmware — the first software that runs, initializes hardware ⑤ Bootloader — loads the OS kernel into memory ⑥ Kernel — the core of the OS. Manages all hardware on behalf of software ⑦ System Calls — the interface between user programs and the kernel ⑧ Shell / Runtime — command line, language runtimes (Python, JVM, Node) ⑨ Applications — everything you see and use What the OS does: the OS is a resource manager and hardware abstractor. It: • Virtualizes the CPU — makes each program think it has the whole CPU • Virtualizes memory — gives each process its own private address space • Manages I/O — provides unified interfaces to disks, network, keyboard, display • Enforces isolation — programs cannot crash or spy on each other (usually) • Provides system calls — the API for interacting with hardware This chapter answers: What is a CPU, really? What is RAM? What does BIOS do? What is a kernel? What happens when your Python script runs? How do processes work? What is a file system? By the end: you will be able to look at your computer and understand every layer of what's happening inside.
DIAGRAM
┌──────────────────────────────────────────────────────────┐ │ APPLICATIONS │ │ Python, Browser, VS Code, Games │ ├──────────────────────────────────────────────────────────┤ │ STANDARD LIBRARY / RUNTIME │ │ libc, Python interpreter, JVM, V8 │ ├──────────────────────────────────────────────────────────┤ │ SYSTEM CALLS │ │ open(), read(), write(), fork(), mmap() │ ├──────────────────────────────────────────────────────────┤ │ OS KERNEL │ │ Process Manager, Memory Manager, File System │ ├──────────────────────────────────────────────────────────┤ │ DEVICE DRIVERS │ │ NIC driver, GPU driver, disk driver │ ├──────────────────────────────────────────────────────────┤ │ BIOS / UEFI FIRMWARE │ ├──────────────────────────────────────────────────────────┤ │ HARDWARE │ │ CPU │ RAM │ Storage │ NIC │ GPU │ Motherboard │ └──────────────────────────────────────────────────────────┘
CODE