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.

The chain of causes: the letter never made it to storage.

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.

  1. Open: the spreadsheet is copied from the SSD into memory.
  2. Change: the new expenses are only in the copy. The SSD still holds the old spreadsheet.
  3. Save: the changed spreadsheet is written to the SSD and replaces the old one.
  4. 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.

In the same laptop, the SSD holds 32 times as much as memory.
FeatureMemory (RAM)Storage
Without powergoes blankkeeps everything
Speedvery fastslower
In the laptop16 GB512 GB
In a phone8 GB256 GB
Used forwhat is running nowwhat 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

Memory holds what the processor is working on right now and loses everything without power. Whatever should last has to be saved to storage.

Tasks

Three tasks complete the lesson. The order does not matter, the text above stays where it is.

Task 1 · Order

You change the address in your résumé. Put the steps in the order in which they happen.

Drag the rows into the right order.

  1. 1Saving writes it back to the SSD
  2. 2The résumé is on the SSD
  3. 3Opening copies it into memory
  4. 4You change the address in the copy

Task 2 · Fill in

Fill in the words.

Tap a word, it goes into the marked gap.

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?

One answer is right.

Go deeper

Three more tasks, optional. They do not count for completing the lesson.

Task 4 · Several right · optional

A laptop is advertised with “12 GB RAM, 1 TB SSD.” What is true?

Several answers are right. Pick all of them.

Task 5 · Sorting · optional

The laptop suddenly switches off, and no program saves on its own. What is still there after restarting?

Drag every card into its group, or tap the group.

5 cards left

Vacation photos from last week

Task 6 · Choice · optional

A program saves on its own every 10 minutes, last at 14:20. At 14:27 the battery dies. What is missing afterward?

One answer is right.

Back to the chapter