CloudAcademia
EN

Cloud Computing · Module 01 · How Computers Work

How Computers Work

Lesson30 minFoundationsMarkdown

Showing raw Markdown: the renderer could not load.

## Why this matters
Imagine you want to put a small website online and a company offers you "a server with 2 vCPU, 4 GB of RAM and a 50 GB disk" for a few euros a month. Is that a lot? Too little? You can't tell unless you know what those words mean.

Every cloud service, from a website to a video-streaming platform, runs on computers. Cloud computing is, at heart, renting computers that sit in someone else's building. So before renting one, it helps to know what is inside a computer and how to read its description. That is all this lesson does. No cloud knowledge and no terminal are needed.

## Learning objectives
By the end of this lesson you will be able to:
- Identify the main parts of a computer (processor, memory, storage, network) and what each does.
- Explain the difference between memory (RAM) and storage, and why data in memory disappears when the power goes off.
- Explain what an operating system does and name common ones.
- Read the specifications of a computer (cores, GB of RAM, GB of storage) and find them on your own device.

## Key concepts

### A computer is a kitchen
Think of a restaurant kitchen. A **cook** follows recipes. The cook works on a **worktop**: small, right next to them, and wiped clean when the shift ends. Ingredients you won't need today stay in the **pantry**: bigger, a few steps away, and everything is still there tomorrow. Food and orders arrive and leave through the **door**.

A computer has the same four parts:

- The **processor** (also called the **CPU**, short for central processing unit) is the cook. It does the work by following instructions, billions of tiny steps every second.
- The **memory** (also called **RAM**, short for random-access memory) is the worktop. It holds what you are using right now: the web page you have open, the document you are typing.
- The **storage** is the pantry. It keeps your files, photos and apps for as long as you want, even with the computer switched off.
- The **network** is the door. It connects the computer to other computers and to the Internet, so data can come in (a web page) and go out (a message you send).

<figure class="diagram" style="--dg-w: 1040px"><svg xmlns="http://www.w3.org/2000/svg" class="dg" viewBox="0 0 1040 352" width="1040" height="352" role="img" aria-labelledby="computer-kitchen-title computer-kitchen-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="computer-kitchen-title">A computer as a kitchen: processor, memory, storage and network</title>
<desc id="computer-kitchen-desc">Four columns compare a kitchen with a computer. The cook, who follows the recipe step by step very fast, is the processor (CPU), which does the work by following instructions. The worktop, small, close at hand and wiped clean when the shift ends, is the memory (RAM), which holds what you are working on right now. The pantry, big, a few steps away and keeping everything for later, is the storage, which keeps files, apps and photos for good. The deliveries, ingredients and orders coming and going through the door, are the network, which connects the computer to the Internet.</desc>
<rect class="dg-bg" x="0.5" y="0.5" width="1039" height="351" rx="16" fill="#ffffff" stroke="#e3e3dd"/>
<text x="24" y="36" font-size="11" class="dg-muted" fill="#5c5c68" font-weight="700" letter-spacing="1.2">IN THE KITCHEN</text>
<rect class="dg-card" x="24" y="50" width="236" height="104" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l4"><g class="dg-icon" transform="translate(40 66) scale(1.2500)" fill="none" stroke="#c2410c" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="16" height="16" x="4" y="4" rx="2"/><rect width="6" height="6" x="9" y="9" rx="1"/><path d="M15 2v2"/><path d="M15 20v2"/><path d="M2 15h2"/><path d="M2 9h2"/><path d="M20 15h2"/><path d="M20 9h2"/><path d="M9 2v2"/><path d="M9 20v2"/></g></g>
<g class="dg-l4"><text x="82" y="87" font-size="15" class="dg-ink" fill="#c2410c" font-weight="700">The cook</text></g>
<text x="42" y="118" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Follows the recipe step by</text>
<text x="42" y="138" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">step, very fast</text>
<g class="dg-l4"><path class="dg-stroke" d="M142 160V186" stroke="#c2410c" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l4"><path class="dg-stroke" d="M136 181l6 8 6-8" stroke="#c2410c" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<rect class="dg-card" x="276" y="50" width="236" height="104" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(292 66) scale(1.2500)" fill="none" stroke="#0369a1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 19v-3"/><path d="M10 19v-3"/><path d="M14 19v-3"/><path d="M18 19v-3"/><path d="M8 11V9"/><path d="M16 11V9"/><path d="M12 11V9"/><path d="M2 15h20"/><path d="M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z"/></g></g>
<g class="dg-l1"><text x="334" y="87" font-size="15" class="dg-ink" fill="#0369a1" font-weight="700">The worktop</text></g>
<text x="294" y="118" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Small, close at hand, wiped</text>
<text x="294" y="138" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">clean when the shift ends</text>
<g class="dg-l1"><path class="dg-stroke" d="M394 160V186" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M388 181l6 8 6-8" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<rect class="dg-card" x="528" y="50" width="236" height="104" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(544 66) scale(1.2500)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/></g></g>
<g class="dg-l2"><text x="586" y="87" font-size="15" class="dg-ink" fill="#15803d" font-weight="700">The pantry</text></g>
<text x="546" y="118" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Big, a few steps away, keeps</text>
<text x="546" y="138" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">everything for later</text>
<g class="dg-l2"><path class="dg-stroke" d="M646 160V186" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l2"><path class="dg-stroke" d="M640 181l6 8 6-8" stroke="#15803d" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<rect class="dg-card" x="780" y="50" width="236" height="104" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l7"><g class="dg-icon" transform="translate(796 66) scale(1.2500)" fill="none" stroke="#6d28d9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.86a10 10 0 0 1 14 0"/><path d="M8.5 16.43a5 5 0 0 1 7 0"/></g></g>
<g class="dg-l7"><text x="838" y="87" font-size="15" class="dg-ink" fill="#6d28d9" font-weight="700">The deliveries</text></g>
<text x="798" y="118" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">Ingredients and orders come</text>
<text x="798" y="138" font-size="13" class="dg-muted" fill="#5c5c68" font-weight="500">and go through the door</text>
<g class="dg-l7"><path class="dg-stroke" d="M898 160V186" stroke="#6d28d9" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l7"><path class="dg-stroke" d="M892 181l6 8 6-8" stroke="#6d28d9" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<text x="24" y="210" font-size="11" class="dg-muted" fill="#5c5c68" font-weight="700" letter-spacing="1.2">IN THE COMPUTER</text>
<rect class="dg-card" x="24" y="224" width="236" height="104" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l4"><g class="dg-icon" transform="translate(40 240) scale(1.2500)" fill="none" stroke="#c2410c" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect width="16" height="16" x="4" y="4" rx="2"/><rect width="6" height="6" x="9" y="9" rx="1"/><path d="M15 2v2"/><path d="M15 20v2"/><path d="M2 15h2"/><path d="M2 9h2"/><path d="M20 15h2"/><path d="M20 9h2"/><path d="M9 2v2"/><path d="M9 20v2"/></g></g>
<g class="dg-l4"><text x="82" y="261" font-size="15" class="dg-ink" fill="#c2410c" font-weight="700">Processor (CPU)</text></g>
<text x="42" y="296" font-size="12.5" class="dg-muted" fill="#5c5c68" font-weight="500">Does the work</text>
<rect class="dg-card" x="276" y="224" width="236" height="104" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(292 240) scale(1.2500)" fill="none" stroke="#0369a1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 19v-3"/><path d="M10 19v-3"/><path d="M14 19v-3"/><path d="M18 19v-3"/><path d="M8 11V9"/><path d="M16 11V9"/><path d="M12 11V9"/><path d="M2 15h20"/><path d="M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z"/></g></g>
<g class="dg-l1"><text x="334" y="261" font-size="15" class="dg-ink" fill="#0369a1" font-weight="700">Memory (RAM)</text></g>
<text x="294" y="296" font-size="12.5" class="dg-muted" fill="#5c5c68" font-weight="500">Holds what you are working on right now</text>
<rect class="dg-card" x="528" y="224" width="236" height="104" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(544 240) scale(1.2500)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/></g></g>
<g class="dg-l2"><text x="586" y="261" font-size="15" class="dg-ink" fill="#15803d" font-weight="700">Storage</text></g>
<text x="546" y="296" font-size="12.5" class="dg-muted" fill="#5c5c68" font-weight="500">Keeps files, apps and photos for good</text>
<rect class="dg-card" x="780" y="224" width="236" height="104" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l7"><g class="dg-icon" transform="translate(796 240) scale(1.2500)" fill="none" stroke="#6d28d9" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h.01"/><path d="M2 8.82a15 15 0 0 1 20 0"/><path d="M5 12.86a10 10 0 0 1 14 0"/><path d="M8.5 16.43a5 5 0 0 1 7 0"/></g></g>
<g class="dg-l7"><text x="838" y="261" font-size="15" class="dg-ink" fill="#6d28d9" font-weight="700">Network</text></g>
<text x="798" y="296" font-size="12.5" class="dg-muted" fill="#5c5c68" font-weight="500">Connects the computer to the Internet</text>
</svg></figure>

*Figure 1. Each part of the kitchen has a twin in the computer; the colours match.*

A phone, a laptop and a server in a datacentre all have these four parts. A server is just a computer that is built to answer other computers, usually without a screen or keyboard.

> [!CHECK]
> In the kitchen picture, which part of a computer is the worktop?
>
> - [ ] The processor
> - [x] The memory (RAM)
> - [ ] The storage
> - [ ] The network
>
> The worktop is small, close to the cook and holds what you are working on now: that is memory. The processor is the cook, the storage is the pantry.

### The processor: cores and clock speed
The processor follows instructions one after another. Two numbers describe how much it can do.

- **Clock speed** is how many steps the processor can take per second, measured in **GHz** (gigahertz). 1 GHz is one billion steps per second. A cook who works faster gets more done, but a higher number is not always a better processor: how it is built also matters.
- **Cores** are like extra cooks. A processor with 4 cores can work on 4 different jobs at the same time: one core plays your music, another loads a web page. Most phones and laptops today have between 4 and 16 cores.

More cores help when there are many jobs at once. They don't make one single job faster unless the program can split its work between the cooks.

> [!NOTE]
> Many processors can make each core look like two (this is called *hyper-threading* or *simultaneous multithreading*), so a computer with 8 cores may report 16 "CPUs" or "logical processors". Both numbers are correct; they count different things.

### Memory and storage: the worktop and the pantry
Memory and storage both "hold data", which confuses many people. The difference is in two words: **speed** and **memory loss**.

- **Memory (RAM)** is very fast and fairly small (a typical laptop has 8 to 32 GB). It is **volatile**: when the power goes off, everything in it is lost. That is why unsaved work disappears if the computer crashes or the battery dies.
- **Storage** is slower but much bigger (typically 256 GB to a few TB) and **non-volatile**: it keeps its data with no power. Saving a file means copying it from memory to storage.

When you open an app or a document, the computer copies it from storage into memory, because the processor can work on it much faster there. So a computer with more memory can keep more things open at once without slowing down.

<figure class="diagram" style="--dg-w: 1040px"><svg xmlns="http://www.w3.org/2000/svg" class="dg" viewBox="0 0 1040 368" width="1040" height="368" role="img" aria-labelledby="computer-ram-storage-title computer-ram-storage-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="computer-ram-storage-title">Memory versus storage</title>
<desc id="computer-ram-storage-desc">Two cards. Memory (RAM) is very fast, small (typically 4 to 64 GB), holds what is open right now and is empty when the power goes off. Storage, an SSD or an HDD, is slower than RAM, big (typically 256 GB to several TB), holds everything you keep and is kept when the power goes off. An arrow from storage to memory is labelled opening a file or app copies it from storage into memory. A panel at the bottom, power off, says unsaved work in memory is gone and saved files in storage are still there.</desc>
<rect class="dg-bg" x="0.5" y="0.5" width="1039" height="367" rx="16" fill="#ffffff" stroke="#e3e3dd"/>
<rect class="dg-card" x="84" y="24" width="380" height="190" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l1"><g class="dg-icon" transform="translate(100 40) scale(1.2500)" fill="none" stroke="#0369a1" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 19v-3"/><path d="M10 19v-3"/><path d="M14 19v-3"/><path d="M18 19v-3"/><path d="M8 11V9"/><path d="M16 11V9"/><path d="M12 11V9"/><path d="M2 15h20"/><path d="M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z"/></g></g>
<g class="dg-l1"><text x="142" y="61" font-size="16" class="dg-ink" fill="#0369a1" font-weight="700">Memory (RAM)</text></g>
<text x="118" y="90" font-size="13" class="dg-text" fill="#17171c" font-weight="700">•</text>
<text x="134" y="90" font-size="13.5" class="dg-text" fill="#17171c" font-weight="500">Very fast</text>
<text x="118" y="116" font-size="13" class="dg-text" fill="#17171c" font-weight="700">•</text>
<text x="134" y="116" font-size="13.5" class="dg-text" fill="#17171c" font-weight="500">Small: typically 4 to 64 GB</text>
<text x="118" y="142" font-size="13" class="dg-text" fill="#17171c" font-weight="700">•</text>
<text x="134" y="142" font-size="13.5" class="dg-text" fill="#17171c" font-weight="500">Holds what is open right now</text>
<g class="dg-l1"><rect class="dg-tint" x="102" y="168" width="344" height="30" rx="15" fill="#e1edf4" stroke="#8ebcd5" stroke-width="1.2"/><text x="274" y="188" font-size="13" class="dg-ink" fill="#0369a1" font-weight="700" text-anchor="middle">Empty when the power goes off</text></g>
<rect class="dg-card" x="584" y="24" width="380" height="190" rx="12" fill="#ffffff" stroke="#cfcfc8"/>
<g class="dg-l2"><g class="dg-icon" transform="translate(600 40) scale(1.2500)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/></g></g>
<g class="dg-l2"><text x="642" y="61" font-size="16" class="dg-ink" fill="#15803d" font-weight="700">Storage (SSD or HDD)</text></g>
<text x="618" y="90" font-size="13" class="dg-text" fill="#17171c" font-weight="700">•</text>
<text x="634" y="90" font-size="13.5" class="dg-text" fill="#17171c" font-weight="500">Slower than RAM</text>
<text x="618" y="116" font-size="13" class="dg-text" fill="#17171c" font-weight="700">•</text>
<text x="634" y="116" font-size="13.5" class="dg-text" fill="#17171c" font-weight="500">Big: typically 256 GB to several TB</text>
<text x="618" y="142" font-size="13" class="dg-text" fill="#17171c" font-weight="700">•</text>
<text x="634" y="142" font-size="13.5" class="dg-text" fill="#17171c" font-weight="500">Holds everything you keep</text>
<g class="dg-l2"><rect class="dg-tint" x="602" y="168" width="344" height="30" rx="15" fill="#e3f0e8" stroke="#96c6a8" stroke-width="1.2"/><text x="774" y="188" font-size="13" class="dg-ink" fill="#15803d" font-weight="700" text-anchor="middle">Kept when the power goes off</text></g>
<g class="dg-l7"><path class="dg-stroke" d="M582 119.0H476" stroke="#6d28d9" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l7"><path class="dg-stroke" d="M483 113l-8 6 8 6" stroke="#6d28d9" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<text x="524" y="89" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="600" text-anchor="middle">copied</text>
<text x="524" y="105" font-size="12" class="dg-muted" fill="#5c5c68" font-weight="600" text-anchor="middle">when you open</text>
<rect class="dg-panel" x="24" y="236" width="992" height="92" rx="12" fill="#f0f0ec"/>
<g class="dg-warn"><g class="dg-icon" transform="translate(44 254) scale(1.0833)" fill="none" stroke="#b91c1c" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2v10"/><path d="M18.4 6.6a9 9 0 1 1-12.77.04"/></g></g>
<text x="80" y="272" font-size="11" class="dg-muted" fill="#5c5c68" font-weight="700" letter-spacing="1.2">POWER OFF</text>
<g class="dg-warn"><g class="dg-icon" transform="translate(80 288) scale(0.9167)" fill="none" stroke="#b91c1c" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></g></g>
<text x="110" y="305" font-size="13.5" class="dg-text" fill="#17171c" font-weight="600">Unsaved work in memory: gone</text>
<g class="dg-ok"><g class="dg-icon" transform="translate(544 288) scale(0.9167)" fill="none" stroke="#15803d" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></g></g>
<text x="574" y="305" font-size="13.5" class="dg-text" fill="#17171c" font-weight="600">Saved files in storage: still there</text>
<text x="520" y="356" font-size="12.5" class="dg-muted" fill="#5c5c68" font-weight="500" text-anchor="middle">Opening a file or app copies it from storage into memory</text>
</svg></figure>

*Figure 2. Memory is fast and forgets; storage is slower and remembers.*

There are two common kinds of storage. An **SSD** (solid-state drive) has no moving parts, is fast and is used in almost every new phone and laptop. An **HDD** (hard disk drive) stores data on spinning disks: it is slower but cheaper per GB, so you still find it where lots of space matters more than speed.

> [!CHECK]
> You write a long text but don't save it, and then the power goes off. What happens to the text?
>
> - [ ] It stays in the storage, because storage keeps everything
> - [x] It is lost, because it was only in memory, which empties when the power goes off
> - [ ] It moves to the processor
> - [ ] It is saved automatically in the network
>
> Unsaved work lives in RAM, and RAM is volatile. Saving copies the work to storage, which keeps it.

### Units: bits, bytes and GB
Computers store everything (text, photos, songs) as numbers made of only two digits, 0 and 1. One of these digits is a **bit**. Eight bits make a **byte**, enough to store one letter. Bigger amounts use the same prefixes as metres and grams:

| Unit | Size | Roughly |
|---|---|---|
| 1 **KB** (kilobyte) | 1,000 bytes | a short text message |
| 1 **MB** (megabyte) | 1,000 KB | one photo or a minute of music |
| 1 **GB** (gigabyte) | 1,000 MB | about 200 songs, or an hour of standard video |
| 1 **TB** (terabyte) | 1,000 GB | about 250,000 photos |

Memory and storage are measured in bytes (GB, TB); network speed is measured in bits per second (for example 100 Mbit/s). Watch the capital letters: `B` is bytes and `b` is bits, and a byte is 8 bits.

> [!NOTE]
> Some systems count in steps of 1,024 instead of 1,000. The proper name for 1,024 × 1,024 × 1,024 bytes is a **GiB** (gibibyte), which is about 7% more than a GB. That is why a drive sold as "1 TB" may show about 931 GB in your computer: same bytes, different unit. For now, treat GB and GiB as "about the same".

> [!CHECK]
> A laptop has 16 GB of RAM and a 512 GB SSD. Which statement is true?
>
> - [ ] It can keep 512 GB of data in memory
> - [ ] The RAM is bigger than the SSD
> - [x] The SSD can keep much more data than the RAM, and keeps it when switched off
> - [ ] 16 GB is the speed of the processor
>
> Storage (512 GB) is much larger than memory (16 GB). Processor speed is measured in GHz, not GB.

### The operating system
You don't tell the processor which bytes to move or which part of the disk to read. A program called the **operating system** (**OS**) does that. Think of the manager of the kitchen: customers (the apps) say what they want, and the manager decides which cook does it, where things are put on the worktop and which shelf of the pantry holds what.

The operating system:

- starts the computer when you press the power button;
- shares the processor and memory between all the apps that are open, so they don't get in each other's way;
- keeps your files organised in **folders** (also called directories): a **file** is one named piece of data, such as a photo or a document, and a folder is a container for files and other folders;
- talks to the hardware (screen, keyboard, printer, Wi-Fi) so that each app doesn't have to.

The common ones are Windows and macOS on computers, Linux on servers (and on some computers), Android and iOS on phones. An **app** (application) is a program you use to do something, such as a browser or a messaging program. Apps are written for an operating system: a Windows program does not run directly on macOS.

<figure class="diagram" style="--dg-w: 1040px"><svg xmlns="http://www.w3.org/2000/svg" class="dg" viewBox="0 0 1040 448" width="1040" height="448" role="img" aria-labelledby="computer-os-layers-title computer-os-layers-desc" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif" xml:lang="en">
<title id="computer-os-layers-title">The operating system sits between apps and hardware</title>
<desc id="computer-os-layers-desc">Three layers stacked. At the top, apps such as a browser, a photo editor, a game and messaging. In the middle, the operating system, for example Windows, macOS, Linux, Android or iOS, which starts the computer, shares the processor and memory between apps, keeps files and folders and talks to every device. At the bottom, the hardware: processor, memory, storage and network. Apps ask the operating system for what they need and the operating system shares the hardware out.</desc>
<rect class="dg-bg" x="0.5" y="0.5" width="1039" height="447" rx="16" fill="#ffffff" stroke="#e3e3dd"/>
<g class="dg-l7"><rect class="dg-tint" x="24" y="24" width="992" height="108" rx="16" fill="#f6f2fd" stroke="#c5a9f0" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(40 37) scale(0.7500)" fill="none" stroke="#6d28d9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></g>
<text x="66" y="51" font-size="13" class="dg-ink" fill="#6d28d9" font-weight="700">Apps</text></g>
<g class="dg-l7"><rect class="dg-card" x="42" y="70" width="228.5" height="44" rx="10" fill="#ffffff" stroke="#b694ec" stroke-width="1.2"/><text x="156.25" y="97" font-size="14" class="dg-ink" fill="#6d28d9" font-weight="700" text-anchor="middle">Browser</text></g>
<g class="dg-l7"><rect class="dg-card" x="284.5" y="70" width="228.5" height="44" rx="10" fill="#ffffff" stroke="#b694ec" stroke-width="1.2"/><text x="398.75" y="97" font-size="14" class="dg-ink" fill="#6d28d9" font-weight="700" text-anchor="middle">Photo editor</text></g>
<g class="dg-l7"><rect class="dg-card" x="527" y="70" width="228.5" height="44" rx="10" fill="#ffffff" stroke="#b694ec" stroke-width="1.2"/><text x="641.25" y="97" font-size="14" class="dg-ink" fill="#6d28d9" font-weight="700" text-anchor="middle">Game</text></g>
<g class="dg-l7"><rect class="dg-card" x="769.5" y="70" width="228.5" height="44" rx="10" fill="#ffffff" stroke="#b694ec" stroke-width="1.2"/><text x="883.75" y="97" font-size="14" class="dg-ink" fill="#6d28d9" font-weight="700" text-anchor="middle">Messaging</text></g>
<g class="dg-l4"><rect class="dg-tint" x="24" y="158" width="992" height="124" rx="16" fill="#fbf4f0" stroke="#e7b39e" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(40 171) scale(0.7500)" fill="none" stroke="#c2410c" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16"/></g>
<text x="66" y="185" font-size="13" class="dg-ink" fill="#c2410c" font-weight="700">Operating system</text></g>
<g class="dg-l4"><rect class="dg-card" x="42" y="204" width="180" height="44" rx="10" fill="#ffffff" stroke="#e0a086" stroke-width="1.2"/><text x="132" y="231" font-size="14" class="dg-ink" fill="#c2410c" font-weight="700" text-anchor="middle">Windows</text></g>
<g class="dg-l4"><rect class="dg-card" x="236" y="204" width="180" height="44" rx="10" fill="#ffffff" stroke="#e0a086" stroke-width="1.2"/><text x="326" y="231" font-size="14" class="dg-ink" fill="#c2410c" font-weight="700" text-anchor="middle">macOS</text></g>
<g class="dg-l4"><rect class="dg-card" x="430" y="204" width="180" height="44" rx="10" fill="#ffffff" stroke="#e0a086" stroke-width="1.2"/><text x="520" y="231" font-size="14" class="dg-ink" fill="#c2410c" font-weight="700" text-anchor="middle">Linux</text></g>
<g class="dg-l4"><rect class="dg-card" x="624" y="204" width="180" height="44" rx="10" fill="#ffffff" stroke="#e0a086" stroke-width="1.2"/><text x="714" y="231" font-size="14" class="dg-ink" fill="#c2410c" font-weight="700" text-anchor="middle">Android</text></g>
<g class="dg-l4"><rect class="dg-card" x="818" y="204" width="180" height="44" rx="10" fill="#ffffff" stroke="#e0a086" stroke-width="1.2"/><text x="908" y="231" font-size="14" class="dg-ink" fill="#c2410c" font-weight="700" text-anchor="middle">iOS</text></g>
<text x="42" y="270" font-size="12.5" class="dg-muted" fill="#5c5c68" font-weight="500">Starts the computer, shares the processor and memory between apps, keeps files and folders, and talks to every device</text>
<g class="dg-l2"><rect class="dg-tint" x="24" y="316" width="992" height="108" rx="16" fill="#f1f7f3" stroke="#a1ccb1" stroke-width="1.2" stroke-dasharray="6 5"/>
<g class="dg-icon" transform="translate(40 329) scale(0.7500)" fill="none" stroke="#15803d" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="16" height="16" x="4" y="4" rx="2"/><rect width="6" height="6" x="9" y="9" rx="1"/><path d="M15 2v2"/><path d="M15 20v2"/><path d="M2 15h2"/><path d="M2 9h2"/><path d="M20 15h2"/><path d="M20 9h2"/><path d="M9 2v2"/><path d="M9 20v2"/></g>
<text x="66" y="343" font-size="13" class="dg-ink" fill="#15803d" font-weight="700">Hardware</text></g>
<g class="dg-l2"><rect class="dg-card" x="42" y="362" width="228.5" height="44" rx="10" fill="#ffffff" stroke="#8ac09e" stroke-width="1.2"/><text x="156.25" y="389" font-size="14" class="dg-ink" fill="#15803d" font-weight="700" text-anchor="middle">Processor</text></g>
<g class="dg-l2"><rect class="dg-card" x="284.5" y="362" width="228.5" height="44" rx="10" fill="#ffffff" stroke="#8ac09e" stroke-width="1.2"/><text x="398.75" y="389" font-size="14" class="dg-ink" fill="#15803d" font-weight="700" text-anchor="middle">Memory</text></g>
<g class="dg-l2"><rect class="dg-card" x="527" y="362" width="228.5" height="44" rx="10" fill="#ffffff" stroke="#8ac09e" stroke-width="1.2"/><text x="641.25" y="389" font-size="14" class="dg-ink" fill="#15803d" font-weight="700" text-anchor="middle">Storage</text></g>
<g class="dg-l2"><rect class="dg-card" x="769.5" y="362" width="228.5" height="44" rx="10" fill="#ffffff" stroke="#8ac09e" stroke-width="1.2"/><text x="883.75" y="389" font-size="14" class="dg-ink" fill="#15803d" font-weight="700" text-anchor="middle">Network</text></g>
<g class="dg-l1"><path class="dg-stroke" d="M520.0 134V148" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M514 147l6 8 6-8" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><rect class="dg-bg-plain" x="612.54" y="134" width="294.92" height="24" rx="12" fill="#ffffff"/><text x="760" y="150.5" font-size="11.5" class="dg-ink" fill="#0369a1" font-weight="600" text-anchor="middle">ask the operating system for what they need</text></g>
<g class="dg-l1"><path class="dg-stroke" d="M520.0 284V306" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><path class="dg-stroke" d="M514 305l6 8 6-8" stroke="#0369a1" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></g>
<g class="dg-l1"><rect class="dg-bg-plain" x="609.32" y="288" width="301.36" height="24" rx="12" fill="#ffffff"/><text x="760" y="304.5" font-size="11.5" class="dg-ink" fill="#0369a1" font-weight="600" text-anchor="middle">the operating system shares the hardware out</text></g>
</svg></figure>

*Figure 3. Apps never talk to the hardware directly: the operating system is in the middle.*

The physical parts (processor, memory, storage, network card) are called **hardware**. Programs, including the operating system and apps, are called **software**.

> [!CHECK]
> What is the main job of an operating system?
>
> - [ ] To store all your files permanently
> - [ ] To make the processor run at a higher GHz
> - [x] To manage the hardware and share it between the apps
> - [ ] To connect the computer to the Internet service provider
>
> The OS sits between apps and hardware and decides who uses the processor, memory and storage. It uses storage and the network, but it is not either of them.

## How it works
Here is what happens when you open a photo, using only the parts above.

1. You double-click the photo. The operating system asks the storage for the file.
2. The storage sends the file's data, and the operating system places a copy in memory.
3. The processor reads that copy and works out what to show on screen. A photo editor app does this for you.
4. The photo appears. If you edit it, the changes happen in memory only.
5. When you save, the operating system copies the new version from memory back to storage.
6. If the photo is stored online, the network carries it between your computer and a server.

Notice that each part has one job and that the operating system coordinates them.

## Worked example
Back to the offer from the start: **"2 vCPU, 4 GB RAM, 50 GB disk"**. You can now read it.

| In the offer | Which part | What it means for you |
|---|---|---|
| 2 vCPU | Processor | Two "virtual" cooks: you can run about two jobs at once |
| 4 GB RAM | Memory | A worktop of 4 GB: enough for a small website, tight for many programs at once |
| 50 GB disk | Storage | A pantry of 50 GB: space for the system, your site and its files |

The "v" in **vCPU** stands for virtual. A cloud company owns big physical computers and shares each one between many customers; your "server" is a slice of one, and the vCPU is a share of the physical processor. You will see how in the next modules. For now, notice that the offer lists the same parts you know: processor, memory and storage, with the network and the operating system as extras.

> [!NOTE]
> Providers don't all define a vCPU in the same way (often it is one logical processor, i.e. half a core on a system with hyper-threading). When it matters, read the provider's documentation.

> [!CHECK]
> A server is described as "8 vCPU, 32 GB RAM, 500 GB disk". Which number tells you how much data it can keep when switched off?
>
> - [ ] 8, the vCPUs
> - [ ] 32 GB, the RAM
> - [x] 500 GB, the disk
> - [ ] None of them
>
> The disk is storage and storage keeps data without power. RAM empties when the power goes off, and vCPUs describe processing power.

## Common pitfalls
- **Mixing up memory and storage** — "I have 512 GB of memory" is usually storage. If you say RAM, you mean the worktop; if you say storage, the pantry.
- **Thinking more GHz always means faster** — cores, design and the work being done also matter. Compare processors with care.
- **Forgetting to save** — work in memory is lost when the power goes off. Save often, or use apps that save automatically.
- **Confusing MB and Mb** — MB is megabytes (file sizes), Mb is megabits (network speeds). One byte is 8 bits.
- **Expecting a program for one OS to run on another** — an app made for Windows won't run directly on Android. Check which systems an app supports.

## Security considerations
- Keep the operating system and apps **updated**: updates fix security holes that attackers use.
- Memory is wiped when the power goes off, but storage keeps your data. Before you give away or sell a computer or phone, use its "reset" or "erase" option so your files can't be recovered.
- Lost devices are a risk for the data in storage. Turning on **disk encryption** (BitLocker on Windows, FileVault on macOS, the encryption option during Linux installation, device encryption on phones) means a thief can't read the files without your password.
- Back up important files to a second place. A drive can fail without warning.

## Summary
- A computer has a processor (does the work), memory (what is open now), storage (what is kept) and a network connection.
- Memory (RAM) is fast and loses its content when the power goes off; storage is slower, bigger and keeps data.
- Specs use units: GHz for processor speed, cores for jobs at once, GB and TB for memory and storage.
- The operating system manages the hardware and shares it between apps; Windows, macOS, Linux, Android and iOS are common ones.
- A cloud offer such as "2 vCPU, 4 GB RAM, 50 GB disk" lists these same parts.

## Glossary
| Term | Definition |
|---|---|
| Processor (CPU) | The part of a computer that does the work by following instructions. CPU stands for central processing unit. |
| Memory (RAM) | Fast, small, temporary space for what is in use right now. RAM stands for random-access memory. |
| Storage | Slower, larger space that keeps files, apps and the operating system even without power. |
| Network | The connection between a computer and other computers or the Internet. |
| Server | A computer built to answer requests from other computers, usually without a screen. |
| Clock speed | How many steps per second a processor can take, measured in GHz. |
| GHz | Gigahertz: one billion cycles per second. |
| Cores | Separate processing units inside one processor; each can work on a different job. |
| Volatile | Loses its content when the power goes off (like RAM). |
| Non-volatile | Keeps its content without power (like storage). |
| SSD | Solid-state drive: fast storage with no moving parts. |
| HDD | Hard disk drive: storage on spinning disks; slower but cheaper per GB. |
| Bit | One 0 or 1, the smallest unit of data. |
| Byte | Eight bits; enough for one letter. |
| KB, MB, GB, TB | Kilobyte, megabyte, gigabyte and terabyte: 1,000 times each other, starting from the byte. |
| GiB | Gibibyte: 1,024 × 1,024 × 1,024 bytes, about 7% more than a GB. |
| Operating system (OS) | The software that starts the computer, manages the hardware and shares it between apps. |
| File | One named piece of data, such as a photo or document. |
| Folder | A container for files and other folders. |
| App | A program you use to do a task, such as a browser. |
| Hardware | The physical parts of a computer. |
| Software | Programs: the operating system and apps. |
| vCPU | A virtual CPU: a share of a physical processor given to a cloud server. |
| Disk encryption | Scrambling the stored data so it can only be read with the right password. |

## Check your understanding
1. Explain in your own words, using the kitchen picture, why a computer needs both memory and storage.
2. A phone says "6 GB RAM, 128 GB storage". Which number limits how many photos it can keep, and which how many apps it can keep open at once?
3. Why can't you simply install a Windows app on your phone?

## References
- [How computers work, Khan Academy](https://www.khanacademy.org/computing/computer-science/how-computers-work2)
- [Prefixes for binary multiples (KiB, MiB, GiB), NIST](https://physics.nist.gov/cuu/Units/binary.html)