The flusher is responsible for scheduling and writing all write-required (dirty) frames back to disk.
All write-required buffers are periodically flushed to disk in the normal sequence of events. The flush Command is provided to ensure data integrity at any given moment.
For UNIX: The flush interval is set with the set-flush Command.
For Windows: Not supported.
Roughly ten percent of the write-required frames are flushed at each activation.
A normal flush that scans the memory for dirty (changed) buffers and writes them to disk. Both user data and workspace are affected. This action is a low priority process. If another process accesses the disk to read in a frame, the flusher stops immediately and goes back to sleep.
A forced flush writes data, as opposed to workspace, back to disk. This mechanism is a high priority process. When the flusher starts scanning memory for buffers belonging to the file system, it does not stop if another process needs access to the disk.
The forced flush guarantees that all updates to the file system are written back to disk within a finite, reasonably predictable time. To achieve this, a forced flush period is defined. This is the period in which the flusher wakes up and starts writing data back to disk. Note that this is not necessarily the time after which all data is written back. Consider the following example: a system has 16 MB of data, on a 2 KB frame system (8,000 frames in memory). If all the memory had been dirtied, an average disk write takes 15 ms, and if the forced flush period is 5 seconds, then the guaranteed time after which all data is written to disk is:
5 seconds + 8,000 * 0.015 = 125 seconds
A more realistic calculation would take into account the number of frames a system can actually modify within 5 seconds. Most likely, to be able to modify a frame, a process must first read it from disk. With an average disk read time of 15 ms, the system is able to read 5 / 0.015 = 333 frames. The above calculation then becomes:
5 seconds + 333 * 0.015 = 10 seconds
The actual time is probably somewhere between these two values, since items can be created without having to be read from disk.
The forced flush mechanism can be either disabled, in which case there is no guarantee data will be written back in a predetermined time (it is written back by the flush command or by a shutdown), or set into an immediate mode, where each process is performing its own writes. The second mode should be used when the need for higher data integrity is required because this mode of operation can cause performance degradation.
The buffers command reports the number of frames waiting to be forced flushed in the Enqueued Writes counter.
See Also