Part 1 of 7 · 1 min read
Why this page comes third
In this module you will
- Explain why flash can be read and programmed by page but erased only by block.
- Explain why an SSD cannot overwrite a page in place, and what the flash translation layer does instead.
- Compute write amplification for a given garbage collection case, and from a simulator.
- Estimate how long a drive lasts from its erase cycles and its write amplification.
- Explain what TRIM tells the drive, and read the TRIM settings of a Linux disk.
Page 1 explained a disk by its moving parts. Page 2 chose the order of requests to reduce the movement. A solid-state drive has no moving parts, so most of those ideas change. Its own problems come from how flash memory is erased. This page covers them, and page 7 shows how to measure what a real drive does. Level 9 returns to flash when it covers file systems that are made for it.
About this example About this example
Real: The simulator in section 3 was compiled with gcc -Wall -Wextra and run on a Linux test machine (2 processors, kernel 6.18, glibc 2.39). The discard settings in section 5 were read from /sys/block/vda/queue/ and lsblk -D on that machine, which has a virtual flash disk.
Scripted: The timings of 50 microseconds to read, 500 to program and 3 ms to erase, the 3,000 and 1,000 erase cycles, and the drive sizes are made up to show the idea. Real chips differ by type and by maker.
Not real: The simulator has 64 blocks of 64 pages and a greedy collector. A real drive has thousands of blocks, several chips that work in parallel, a cache, and many extra rules. Its write amplification is lower or higher depending on the maker.