Cyber basics · Lesson 2 of 6

How computers work (for future defenders)

CPU, memory, storage and the operating system explained simply, plus bits and bytes, and why all of it matters when you’re protecting a computer.

⏱ 14 min🎯 Beginner🧪 Hands-on✅ 4-question quiz🎬 Video✓ Completed

By the end, you’ll be able to…

  • Name the main parts of a computer and what each one does
  • Explain bits and bytes, and count in binary up to 255
  • Describe what an operating system does and why updates matter

Key words

CPU
The processor: it follows instructions, billions of tiny steps per second.
RAM
Short-term memory for whatever is running right now. It’s wiped when the power goes off.
Storage
Long-term memory (SSD or hard drive) that keeps files when the computer is off.
Bit
The smallest piece of data: a single 0 or 1.
Byte
8 bits. One byte can store a number from 0 to 255, or one simple character like A.
Operating system
The main software (Windows, macOS, Linux, Android, iOS) that runs everything else and controls the hardware.
Kernel
The core of the operating system. It decides which program gets the CPU, memory and devices.

See all 127 words in the glossary →

Every computer does four things

Your laptop, your phone, a games console and the server that runs a website all do the same four jobs:

  1. Inputkeyboard, touch, network, camera
  2. Processthe CPU follows instructions
  3. StoreRAM for now, storage for later
  4. Outputscreen, speaker, network
If you can name the input, processing, storage and output, you can understand almost any device.

Security people use this view a lot. Malware has to get in (input), run (process), often hide (storage), and usually send something out (output). Every stage is a chance for a defender to notice it.

The parts inside

  • CPU (processor): the worker. It reads instructions one tiny step at a time, but billions of steps per second.
  • RAM (memory): the desk. Whatever you’re working on right now sits here because it’s fast. Turn the power off and the desk is cleared.
  • Storage (SSD or hard drive): the filing cabinet. Slower than RAM, but it keeps your files, apps and the operating system when the power is off.
  • Network card (Wi-Fi or Ethernet): the door to other computers.

Why defenders care: evidence lives in different places. Some malware only lives in RAM and disappears when you restart. That’s why incident responders sometimes capture memory before turning a computer off.

Bits and bytes: everything is numbers

Inside the computer, everything (text, photos, music, passwords) is stored as bits: tiny switches that are either 0 (off) or 1 (on). Eight bits make a byte.

Each position in a byte is worth double the one to its right: 128, 64, 32, 16, 8, 4, 2, 1. Add up the positions that are switched on, and you get the number. 01000001 is 64 + 1 = 65. In the most common text encoding, 65 means the letter A.

012816403201608040211
01000001 = 64 + 1 = 65, which is the code for the letter A.

That’s also why storage sizes grow in big jumps: a kilobyte is about a thousand bytes, a megabyte about a million, a gigabyte about a billion.

The operating system: the boss

Apps don’t talk to hardware directly. They ask the operating system (OS), and its core, the kernel, decides what’s allowed.

  1. Appsbrowser, games, Discord, your code
  2. Operating systemWindows, macOS, Linux, Android, iOS: files, users, settings
  3. Kernelshares out the CPU and memory, talks to devices, enforces permissions
  4. HardwareCPU, RAM, storage, network card
Each layer only talks to the one directly below it.

The OS also manages users and permissions. A normal account can’t change system files without asking. That one rule stops a lot of malware, which is why you shouldn’t use an administrator account for everyday browsing.

What happens when you open an app?

  1. You clickinput
  2. OS finds the programon storage
  3. Loads it into RAMnow it’s a process
  4. CPU runs itstep by step
  5. Window appearsoutput
A program sitting on your disk is just a file. Once it’s loaded and running, it’s called a process.

This matters for security: a malicious file sitting in your Downloads folder can’t do anything until it’s run. That’s why “don’t open unexpected attachments” is such good advice.

Why updates matter so much

Operating systems and apps contain millions of lines of code, and some of it has mistakes. When a security mistake (a vulnerability) is found and fixed, the fix is shipped as an update or patch. Attackers study those patches too, so an un-updated device is an easy target. Turning on automatic updates is one of the most effective things anyone can do.

Try it on your own computer

Windows: open Task Manager (Ctrl + Shift + Esc). Mac: open Activity Monitor. Linux: run top. You’ll see every running process, and how much CPU and memory each one uses. Just look: don’t end processes you don’t recognise.

🤔 Something not clicking?

🧪 Hands-on

Practice

Flip the bits to build numbers and letters. Can you make 255? What about the letter T (84)?

🎬 Watch

Video: How Computers Work: What Makes a Computer, a Computer?

ComputersHow Computers Work: What Makes a Computer, a Computer?Code.org · Watch on YouTube

Video by Code.org, hosted on YouTube. It loads only when you press play.

✅ Check yourself

Quick quiz

Every answer comes with an explanation, right or wrong. Your best score is saved in this browser.

Q1. You turn off a computer. Which of these is wiped?
Q2. What number is 00001010 in binary?
Q3. Why is browsing the web from an administrator account risky?
Q4. A malicious file sits in your Downloads folder, but you never open it. What has it done?

What’s next

Up nextPasswords, passkeys & MFA →Learn how accounts really get hacked, why password reuse is dangerous, and how password managers, passkeys and multi-factor authentication protect you.⏱ 15 min