Ch. 21 · Operating Systems

Filesystem Writes, Buffers and Durability

Filesystem Writes, Buffers and Durability. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readadvancedupdated Oct 3, 2026

Successful writes can first reach buffers rather than stable storage. Durability depends on synchronization, filesystem behavior and hardware assumptions.

Before you start

You should understand processes, threads, memory and basic file operations. Track ownership and state changes over time. For concurrent scenarios, write down at least two possible execution orders; the same instructions can behave differently when scheduling or resource availability changes.

The practical goal is to reason through this situation: A process can report a write before an abrupt failure loses buffered data. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: State the failure model

Process crash and abrupt power loss have different implications.

Step 2: Trace buffering

Successful write can mean data reached a buffer rather than stable storage.

Step 3: Use required synchronization

Durability may involve file and directory state under filesystem-specific guarantees.

Worked scenario

A process can report a write before an abrupt failure loses buffered data.

An application writes a replacement file, renames it and reports success. Crash recovery depends on the relevant synchronization and filesystem semantics, including metadata. Closing alone is not a universal power-loss guarantee. Define the required atomicity and durability before selecting a persistence sequence.

Common mistake

Closing a file is not a universal guarantee against every crash scenario.

Verify the behavior

Test recovery in a controlled environment under the stated failure assumptions.

Interview exercise

Define durable persistence.

Answer and reasoning

Specify the failure model and required sync behavior, then test recovery rather than equating API success with permanent storage.

Continue learning

Compare the scenario with the Operating Systems interview questions and test your understanding with the Operating Systems MCQs. For terminology and implementation details, consult the reference material.

More in Operating Systems

read ✓Operating Systems · hard

Operating Systems: CPU Cache Locality

Improve performance with spatial and temporal locality, avoid pointer chasing, and understand false sharing between threads.

~2 min readread →
read ✓Operating Systems · hard

Copy-on-Write Memory and fork

How copy-on-write lets fork share pages until a write, why RSS can be misleading, and the implications for memory and latency.

~2 min readread →
esc