Lesson 3 of 4 · Open
Memory and storage
Why unsaved work is gone when the battery dies.
You are writing a long letter to your landlord on your laptop. In the middle of a sentence the battery dies, and the laptop switches off. After charging, the letter is gone. But the photos that have been on the laptop since yesterday are all still there. Why does one disappear and the other does not?
A computer keeps data in two places. Memory, or RAM, holds everything the processor is dealing with at this moment: the open programs and the letter as it looks right now. Memory needs power all the time. When the power is gone, it is empty.
Storage keeps data even without power. In laptops today it is usually an SSD, storage made of chips with no moving parts. Phones have built-in storage of the same kind. Older computers have a hard drive with spinning disks inside, and cameras often use a memory card.
Why the letter is lost
The processor only works with what is in memory. So a new letter is written only there at first, character by character. Nothing of it is on the SSD yet. When the power goes out, it vanishes from memory along with everything else.
Only saving writes the letter from memory to storage. Yesterday's photos were saved there, which is why they survive the dead battery. The opposite way is called opening: it copies data from storage into memory so that the processor can work with it.
New terms
- memory (RAM)
- holds what the processor is working with, is fast, and is empty without power
- storage
- keeps data without power, is larger and slower
- SSD
- storage made of chips, with no moving parts
- hard drive
- storage with spinning disks
- open
- copy data from storage into memory
- save
- write data from memory to storage
Quick check
You open a letter, add two sentences, and do not save. Then the power goes out. What is there afterward?
Example
Open, change, save
You keep a household budget in a spreadsheet and enter the week's expenses.
- Open: the spreadsheet is copied from the SSD into memory.
- Change: the new expenses are only in the copy. The SSD still holds the old spreadsheet.
- Save: the changed spreadsheet is written to the SSD and replaces the old one.
- Now the power may go out. The next time you open it, the new expenses are there.
The story of the lost letter is a little simplified. Many programs today save on their own every so often, for example every few minutes. Then after the battery dies, only what was added since the last automatic save is missing. The way stays the same: automatic saving also writes from memory to storage.
Two kinds, two jobs
Why does a computer have two kinds? Memory is much faster than storage, otherwise the processor would be waiting all the time. In return it is more expensive and therefore smaller. A typical laptop has 16 GB of memory but an SSD with 512 GB.
GB
| Feature | Memory (RAM) | Storage |
|---|---|---|
| Without power | goes blank | keeps everything |
| Speed | very fast | slower |
| In the laptop | 16 GB | 512 GB |
| In a phone | 8 GB | 256 GB |
| Used for | what is running now | what should last |
Typical mistake
Mixing up memory and storage space because both are given in GB. An ad for a phone says “8 GB RAM, 256 GB storage.” Anyone who thinks the photos go into the 8 GB is mistaken: they would be gone the next time the phone switches off. Photos and apps are kept in the 256 GB. The 8 GB only hold what is running right now.
Remember
Tasks
Task 1 · Order
You change the address in your résumé. Put the steps in the order in which they happen.
- 1Saving writes it back to the SSD
- 2The résumé is on the SSD
- 3Opening copies it into memory
- 4You change the address in the copy
Task 2 · Fill in
Fill in the words.
A new document is at first only in . If the power fails, it is , because this kind keeps nothing without power. Only writes it to , where it stays even without power.
Task 3 · Choice
Power cut at the office: the spreadsheet you have been working on since noon is gone. Last week's spreadsheets are still there. Why?
Go deeper
Task 4 · Several right · optional
A laptop is advertised with “12 GB RAM, 1 TB SSD.” What is true?
Task 5 · Sorting · optional
The laptop suddenly switches off, and no program saves on its own. What is still there after restarting?
5 cards left
Task 6 · Choice · optional