How Computers Work

What a computer actually is — hardware, software, the CPU, memory and the operating system — explained with zero assumed knowledge.

basicshardwaresoftwareoperating-system

The one-sentence version

A computer is a machine that follows instructions, very fast. That's it. Everything else — apps, games, websites, AI — is just very long lists of very simple instructions executed billions of times per second.

Why this matters

Every concept later in this roadmap — programming, servers, databases, the cloud — is built on this one idea: machines that follow written instructions. If you get this page, nothing later will feel like magic.

Hardware vs software

Two words you'll hear constantly:

TermWhat it isReal-world analogy
HardwareThe physical parts you can touch: chips, screen, keyboard, diskA kitchen: stove, fridge, counters
SoftwareThe instructions that tell hardware what to doThe recipes the cook follows

The same kitchen can produce a thousand dishes depending on the recipe; the same laptop can be a video editor, a game console or a calculator depending on the software it runs. Hardware without software does nothing. Software without hardware is just text.

The four parts that matter

Open up any computer — laptop, phone, or a server in a data center — and you'll find the same four roles:

  1. CPU (Central Processing Unit) — the "brain", though a better analogy is a very fast, very obedient worker. It can only do tiny things: add two numbers, compare two values, move data around. It just does billions of these per second (a 3 GHz CPU does ~3 billion cycles per second).
  2. RAM (Random Access Memory) — the worker's desk. Whatever the CPU is actively working on sits here, because the desk is fast to reach. It's small and temporary: power off, and the desk is wiped clean.
  3. Storage (hard disk / SSD) — the filing cabinet. Big, permanent, but slower to reach. Your files, apps and the operating system live here and are copied to RAM when needed.
  4. Input / Output (I/O) — how the world talks to the machine (keyboard, mouse, network) and how it answers (screen, speakers, network again).
The speed gap is the whole story

Reaching RAM is ~100× faster than reaching an SSD, which is ~1,000× faster than fetching data over the internet. A huge amount of software engineering — caching, databases, system design — is just working around this speed gap. Remember "desk vs filing cabinet vs warehouse across town"; it comes back at Level 6 (System Design).

Everything is numbers (binary)

Computers store and process everything — text, photos, music, this page — as numbers, and they represent numbers using only two symbols: 0 and 1. Each 0-or-1 is called a bit; a group of 8 bits is a byte.

Why only two symbols? Because hardware is built from switches, and a switch has two reliable states: off (0) and on (1). Billions of microscopic switches (transistors) make up a CPU.

  • The letter A is stored as the number 6501000001
  • A photo is millions of pixels, each pixel three numbers (red, green, blue)
  • A song is thousands of measurements per second of a sound wave, as numbers

So "1 GB of RAM" simply means "room for about one billion bytes of numbers."

What is software, exactly?

Software is a list of instructions for the CPU, written by people. The instructions a CPU understands directly (machine code) are unreadably low-level, so humans write in friendlier programming languages (Python, Java, C++ — Level 1) which get translated down to machine code.

Two big categories:

  • System software — runs the machine itself. The most important example is the operating system.
  • Application software — what users actually use: browsers, games, WhatsApp, Excel.

What is an operating system?

The operating system (OS) — Windows, macOS, Linux, Android, iOS — is the manager that sits between hardware and every app. Apps never talk to the hardware directly; they ask the OS.

It exists because hundreds of programs share one CPU, one RAM and one disk. Without a manager, every app would have to know how to drive every brand of keyboard and would happily overwrite each other's memory. The OS:

  • Schedules which program gets the CPU and for how long (this is why your laptop can play music while you type)
  • Allocates memory so apps can't read or destroy each other's data
  • Manages files so apps see folders and filenames, not raw disk sectors
  • Talks to devices through drivers, so apps don't care which printer brand you own
Industry perspective

Almost every server that runs the internet — Google, Amazon, Netflix, your favorite startup — runs Linux, a free, open-source OS. That's why backend engineers live in the Linux terminal, and why Level 10 (Cloud & DevOps) will get you comfortable there.

From power button to desktop (what "booting" is)

  1. You press power; a tiny program burned into the motherboard (the firmware) wakes up.
  2. It finds the OS in storage and copies its core into RAM.
  3. The OS takes over: starts background services, draws the login screen.
  4. Every app you then open is copied from storage into RAM and handed to the CPU as a running process.

That word process — a program that is currently running — will follow you through your entire career.

Common beginner mistakes

  • Confusing memory and storage. "My laptop has 512 GB of memory" usually means storage. RAM (memory) is the small fast desk (8–32 GB); storage is the big slow cabinet (256 GB–2 TB).
  • Thinking the computer is smart. It isn't. It executes instructions exactly as written, including wrong ones. Every bug you'll ever fix is a machine doing precisely what someone told it to do.
  • Thinking phones aren't computers. A phone is a computer with a touch input, a battery and a radio. Same CPU/RAM/storage/OS structure.
  • Believing "the cloud" is not a computer. It's someone else's computer in a data center — see What is the cloud?.

Interview perspective

At this level interviewers (for internships and entry screenings) test whether your mental model is right, not vocabulary:

Check yourself

You're ready for the next page if you can answer these without looking up:

  1. A friend says "my game is slow, I'll buy a bigger hard drive." Why is that probably the wrong fix, and what part would you upgrade instead?
  2. In the kitchen analogy, what are the recipe, the cook, the counter and the pantry?
  3. What happens, step by step, between pressing the power button and seeing your desktop?

Next up: The Internet — what happens when billions of these machines start talking to each other.