The Page Cache and Dirty Writeback

Follow a buffered write from cached state to storage and see why delayed writeback helps throughput while changing failure semantics.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Cached pages can serve later reads immediately
  2. Completion must be defined at the layer that matters

Cached pages can serve later reads immediately

A buffered file write can update cached pages and mark them dirty. A reader through the coherent cache can see the new bytes before the backing device stores them. Multiple changes to the same cached region may be combined into one later transfer. A writeback scheduler selects pages to flush based on memory pressure, age or an explicit request.

Completion must be defined at the layer that matters

Returning from a buffered write can mean the data were accepted for future transfer. A durability claim requires the documented flush and synchronization behavior through the filesystem and device. If dirty pages are produced faster than they can be cleaned, throttling or latency increases may follow. Crash consistency examines which states may survive a failure. Memory-mapped files can use the same cached pages through a different interface.[1]

References

  1. Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces ↩