A Detailed Example
This page is a generated reference surface for selective reading. It exists to keep the learner apps guide-first while still preserving source access.
Learning objectives
- Explain the main ideas and vocabulary in A Detailed Example.
- Work through the source examples for A Detailed Example without depending on raw chunk order.
- Use A Detailed Example as selective reference when learner modules point back to Ostep.
Prerequisites
- None curated yet.
Module targets
module-04-file-systems-io
AI companion modes
- Explain simply
- Socratic tutor
- Quiz me
- Challenge my understanding
- Diagnose my confusion
- Generate extra practice
- Revision mode
- Connect forward / backward
Source-of-truth note
This unit is anchored to Ostep and the source chapter "A Detailed Example". Use external resources only to clarify, extend, or modernize details without replacing the chapter's conceptual spine.
External enrichment
No chapter-specific enrichment resources are curated yet. Add them in the unit manifest when a source clearly improves learning.
Source provenance
- Primary source:
Ostep - Source chapter: A Detailed Example
- Raw source file:
267-a-detailed-example.md
Merged source
A Detailed Example
A Detailed Example
Because the process of writing (i.e., erasing and programming) is so unusual, let's go through a detailed example to make sure it makes sense.
In this example, imagine we have the following four 8-bit pages, within a 4-page block (both unrealistically small sizes, but useful within this example); each page isVALIDas each has been previously programmed.
Page 0 Page 1 Page 2 Page 3 00011000 11001110 00000001 00111111
VALID VALID VALID VALID
Now say we wish to write to page 0, filling it with new contents. To write any page, we must first erase the entire block. Let's assume we do so, thus leaving the block in this state:
Page 0 Page 1 Page 2 Page 3 11111111 11111111 11111111 11111111
ERASED ERASED ERASED ERASED
Good news! We could now go ahead and program page 0, for example with the contents 00000011, overwriting the old page 0 (contents
- as desired. After doing so, our block looks like this:
Page 0 Page 1 Page 2 Page 3 00000011 11111111 11111111 11111111
VALID ERASED ERASED ERASED
And now the bad news: the previous contents of pages 1, 2, and 3 are all gone! Thus, before overwriting any pagewithina block, we must first move any data we care about to another location (e.g., memory, or elsewhere on the flash). The nature of erase will have a strong impact on how we design flash-based SSDs, as we'll soon learn about.
Summary
To summarize, reading a page is easy: just read the page. Flash chips do this quite well, and quickly; in terms of performance, they offer the potential to greatly exceed the random read performance of modern disk drives, which are slow due to mechanical seek and rotation costs.
Writing a page is trickier; the entire block must first be erased (taking care to first move any data we care about to another location), and then the desired page programmed. Not only is this expensive, but frequent repetitions of this program/erase cycle can lead to the biggest reliability problem flash chips have: wear out. When designing a storage system with flash, the performance and reliability of writing is a central focus.
We'll soon learn more about how modern SSDs attack these issues, delivering excellent performance and reliability despite these limitations.
Read Program Erase
Device (μs) (μs) (μs)
SLC 25 200-300 1500-2000
MLC 50 600-900 ˜3000
TLC ˜75 ˜900-1350 ˜4500