operating-systems

Definition

Cleaning Policy

A cleaning policy determines when modified (dirty) pages are written back to secondary storage. It is the complement of the fetch policy.

Strategies

Demand Cleaning

A page is written to disk only when selected for replacement by the replacement policy.

Benefit: Minimises unnecessary writes; pages modified multiple times incur only one write.
Cost: Page fault latency increases when a dirty page must be written before replacement.

Pre-cleaning

Modified pages are written to disk proactively, before they are selected for replacement.

Benefit: Replacement can proceed immediately (page is already clean).
Cost: Redundant I/O if a page is written then modified again.

Hybrid Approach

Page Buffering

Modern systems combine both strategies. Replaced pages enter a buffer queue. Dirty pages are batched to disk when the disk is idle or when clean page reserves fall below a threshold.