Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 19
Guidelines for Updating State Information
successfully. But certain I/O operations cannot be repeated without changing the
results of the program.
The tradeoff between recoverability and performance. The more update points a
program has, the greater the degree of recoverability, but the lower the
performance of the program.
Locating Update Points for Reads and Writes
The most important consideration in updating state information is to preserve the
results of certain critical I/O operations. Many I/O operations cannot be repeated
without changing the results of the program; therefore, you need to update file and
control state to ensure that if the primary process fails, I/O operations that completed
successfully are not duplicated in the backup process.
For purposes of updating state information, I/O operations can be classified as either
retryable or nonretryable. A retryable operation can be repeated indefinitely with the
same results. A nonretryable operation may cause erroneous or inconsistent results if
repeated.
Retryable reads do not require file state updating; if the backup process takes over, it
can reread the data. Most disk reads are retryable. Reads from the terminal are
generally considered nonretryable. An update point should be placed immediately
after each nonretryable read to protect the data just read. For reads from the terminal,
this means that the user will not need to reenter the data.
Retryable writes should be repeated in the backup process to ensure that they are
performed successfully. To minimize the chance of error, the continuation point should
be placed immediately before the write, because at that point, the exact information to
be written is known.
A nonretryable write is one that, if repeated, may cause erroneous or inconsistent
results. Examples of nonretryable writes are a write to the end-of-file and the printing
of forms. The sync ID can be used to detect and negate duplicate requests for
nonretryable operations. Continuation points should still precede the write, but special
case procedures are required to ensure consistent results. For example, a report to a
line printer might need to be restarted from the last page, or a magnetic tape might
need to be repositioned.
The following table summarizes the strategy for placing update points for I/O
operations:
Each update point should include control state information, application state
information, and, if the update precedes a write to a disk file, file state information.
Adherence to these guidelines ensures that an application program can recover from
disk file operations and, in most cases, terminal operations.
Reads Writes
Retryable None required Immediately before
Nonretryable Immediately after Immediately before, but use special case procedures