flusher Definition/General, flusher Definition/General

flusher

Command flusher Definition/General
Applicable release versions: AP 6.1
Category General (155)
Description 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.

The flushing algorithm varies between implementations of AP. On AP/Unix implementations, the flush interval is set by the "set-flush" command. Roughly ten percent of the write-required frames are flushed at each activation. On AP/Native and AP/DOS implementations, the flusher awakens when there has been no CPU or disk I/O activity, then proceeds to flush all of memory until the next interrupt occurs (such as someone hitting a key on a keyboard).

On AP 6.1 and later, the flush process has two purposes:

- A 'normal' flush, which scans the memory for 'dirty' (i.e. 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 will stop immediately and go back to sleep.

- A 'forced flush', which 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 will not stop if another process needs access to the disk.

The forced flush guarantees that all updates to the file system will be written back to disk within a finite, reasonably predictable time. To achieve this, a forced flush period is defined. This period is the period with which the flusher will wake up and start writing data back to disk. Note this is not necessarily the time after which all data will be written back. Consider the following example: a system has 16 Megabytes of data, on a 2K frame system (i.e. 8,000 frames in memory). If all the memory had been dirtied (which is unlikely), if an average disk write takes 15 ms, and if the forced flush period is 5 seconds, then the guaranteed time after which all data will be 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 will have to read it from disk first. With an average disk read time of 15 ms, the system will be 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 obviously written back by the 'flush' command or by a shutdown), or set into an 'immediate' mode, where each process is doing its own writes. The second mode should be used when the need for higher data integrity is required since 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.
Syntax
Options
Example
Purpose
Related tcl.config.flush
tcl.set-flush
tcl.buf-map
tcl.buffers
tcl.buffers.g
tcl.flush
basic.%setflush

flusher

Command flusher Definition/General
Applicable release versions: AP 6.1
Category General (155)
Description 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.

The flushing algorithm varies between implementations of AP. On AP/Unix implementations, the flush interval is set by the "set-flush" command. Roughly ten percent of the write-required frames are flushed at each activation. On AP/Native and AP/DOS implementations, the flusher awakens when there has been no CPU or disk I/O activity, then proceeds to flush all of memory until the next interrupt occurs (such as someone hitting a key on a keyboard).

On AP 6.1 and later, the flush process has two purposes:

- A 'normal' flush, which scans the memory for 'dirty' (i.e. 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 will stop immediately and go back to sleep.

- A 'forced flush', which 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 will not stop if another process needs access to the disk.

The forced flush guarantees that all updates to the file system will be written back to disk within a finite, reasonably predictable time. To achieve this, a forced flush period is defined. This period is the period with which the flusher will wake up and start writing data back to disk. Note this is not necessarily the time after which all data will be written back. Consider the following example: a system has 16 Megabytes of data, on a 2K frame system (i.e. 8,000 frames in memory). If all the memory had been dirtied (which is unlikely), if an average disk write takes 15 ms, and if the forced flush period is 5 seconds, then the guaranteed time after which all data will be 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 will have to read it from disk first. With an average disk read time of 15 ms, the system will be 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 obviously written back by the 'flush' command or by a shutdown), or set into an 'immediate' mode, where each process is doing its own writes. The second mode should be used when the need for higher data integrity is required since 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.
Syntax
Options
Example
Purpose
Related tcl.config.flush
tcl.set-flush
tcl.buf-map
tcl.buffers
tcl.buffers.g
tcl.flush
basic.%setflush