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

BASH
1# See everything your OS knows about your hardware
2# Run these commands and read the output — this is your computer exposed
3
4# ── CPU info ───────────────────────────────────────────
5cat /proc/cpuinfo # every CPU core: model, MHz, cache, flags
6lscpu # structured CPU info: cores, threads, architecture
7nproc # number of logical CPUs
8
9# ── Memory info ────────────────────────────────────────
10cat /proc/meminfo # total RAM, free, buffers, swap
11free -h # human-readable memory summary
12vmstat -s # virtual memory statistics
13
14# ── Storage ────────────────────────────────────────────
15lsblk # block devices tree (disks and partitions)
16df -h # disk usage per filesystem
17fdisk -l # partition table (requires root)
18
19# ── All hardware ──────────────────────────────────────
20lshw -short # complete hardware list (root)
21lspci # PCI devices (GPU, NIC, audio)
22lsusb # USB devices
23
24# ── OS & kernel version ───────────────────────────────
25uname -a # kernel version + architecture
26cat /etc/os-release # OS name and version
27uptime # how long the system has been running
28
29# ── Running processes ──────────────────────────────────
30ps aux # all running processes
31top # live resource usage
32cat /proc/1/status # process 1 (init/systemd) details
NEXT →1. Hardware — CPU, RAM, Storage