Β§44.1–44.3Flash: Storing Bits, and the Basic Operations

Part III OSTEP pp. 563–566 Β· ~7 min read

  • solid-state drive
  • flash memory
  • flash page
  • flash block
  • multi-level cell

Solid-state drives (SSDs) store data persistently with no moving parts β€” just transistors, like memory and CPUs. The technology is NAND flash , and it has two quirks that make building an SSD a real challenge: to rewrite a small chunk you must first erase a bigger chunk (expensive), and writing a spot too many times wears it out.

The Crux: How To Build A Flash-based SSD

How do we build a fast SSD from raw flash, given the expensive nature of erasing and the fact that repeated overwrites wear the device out?

44.1 Storing a Single Bit

A flash cell stores bits by trapping charge at distinguishable levels β€” a multi-level cell design trades density against speed and endurance:

How many bits a single flash cell stores, by distinguishing levels of trapped charge.
bits/cellcharge levelstrade-off
SLCSLC β€” 1 bit (0 or 1)2 levelsfastest, longest-lived β€” but priciest per GB
MLCMLC β€” 2 bits (00/01/10/11)4 levelsmiddle ground
TLCTLC β€” 3 bits8 levelsdensest & cheapest β€” but slower and shorter-lived
Dotted-underlined cells have explanations β€” click one.

44.2 Blocks and Pages

Flash cells are grouped into banks, and a bank is accessed at two granularities:

  • A flash block (or erase block, 128 KB–2 MB) β€” the unit of erase.
  • A flash page (a few KB) β€” the unit of read and program. Each block holds many pages.

Tip: Be Careful With Terminology

These β€œblock” and β€œpage” mean different things than the disk/FS block and the virtual-memory page we’ve used all along. There’s no central authority for naming β€” your job is to know the right terms for each domain.

Here’s a bank as three blocks of four pages each:

block 0ipg 0ipg 1ipg 2ipg 3block 1ipg 4ipg 5ipg 6ipg 7block 2ipg 8ipg 9ipg 10ipg 11one bank: 3 blocks Γ— 4 pages (all initially invalid)

44.3 The Basic Operations

Flash supports three low-level operations:

  • Read a page: fast (~10s of Β΅s), uniform regardless of location β€” flash is a random-access device (unlike a seeking disk).
  • Erase a block: ~milliseconds, and it resets every bit in the block to 1, destroying all its pages’ contents. Required before any re-programming.
  • Program a page: ~100s of Β΅s, flips selected 1s to 0s to write the page’s data. Only works on an erased page.

So each page moves through states β€” INVALID β†’ (erase) β†’ ERASED β†’ (program) β†’ VALID β€” and once VALID, the only way to change it is to erase its whole block:

A 4-page flash block's life cycle. Gray dashed = INVALID (i), green = ERASED (E, programmable), brown = VALID (V, holds data). The key rule: you can only program an ERASED page.
block 0ipg 0ipg 1ipg 2ipg 3iiii β€” nothing can be programmed yet

1Start: all pages invalid

Initially the pages are in the INVALID state β€” no usable data, and not yet programmable.

step 1 / 6

Why writes are expensive

That erase-before-program rule is the whole story of SSD design. Overwriting a single page forces erasing its entire block β€” which wipes every other page in that block too:

Why overwriting one page is so costly: to rewrite page 0, you must erase the whole block β€” destroying pages 1–3 unless they were copied out first.
block 000011000Vpg 011001110Vpg 100000001Vpg 200111111Vpg 3all four pages hold data

1Four valid pages with data

A 4-page block, each page holding 8 bits of real data (all VALID).

step 1 / 3

Reading is easy and fast (great random-read performance, far beyond a disk). Writing is the hard part β€” erase the block (after saving any data you need), then program β€” and repeating this program/erase cycle is what eventually wears the flash out. The rest of the chapter is about taming these costs.

Check yourself: flash basics and operations

1.What is a solid-state drive (SSD)?

2.How do SLC, MLC, and TLC flash differ?

3.How do a flash PAGE and a flash BLOCK differ?

4.What are the three flash operations and their rough costs?

5.What is flash's defining constraint on writing?

6.Why is overwriting a single page (say page 0) so expensive?

6 questions