All lessons in Software Engineering: Programs, Systems, and Maintainable Software
Files, Buffers, and Crash Consistency
Distinguish visibility, atomic replacement, and persistence when writing a local file.
35 minutes · Members lesson · preview
What you will learn
- Distinguish a completed write call from a durable update.
- Explain why atomic replacement and crash persistence are separate properties.
- Design failure checks around an export file's complete lifecycle.
The lending application exports a report by opening the previous report file, truncating it, and writing new rows. If the process fails halfway through, the last good report is gone and the new report is incomplete. The defect concerns a sequence of filesystem operations, not the CSV formatting alone.
File handling requires several boundaries: application buffers, operating-system buffers, the filesystem namespace, and the persistence guarantees of the storage stack. Keep those boundaries separate when explaining what a successful operation proves.