Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 14
Updating Control State Information
Updating Control State Information
Control state information is used by the backup process to determine where to take
over execution from the primary process. In many cases, a single scalar value is
sufficient. For example, in Figure 27-3, a simple loop reads data from a terminal and
processes it. (Note that Figure 27-3 is conceptual and does not use actual C language
statements.)
The loop counter, i, is used to determine where to resume execution in the backup
process. The update point is placed immediately after the READ. Suppose a failure
occurs at point
when i = 5. The backup process then continues execution at the
previous continuation point, for which i = 4. item[4] is processed and the user must
reenter item[5]. Now suppose the failure occurs at point while i = 5. The backup
process resumes at the just-defined continuation point, processes item[5], then loops
to read item[6]; in this case, the failure is transparent to the user.
Figure
27-4 shows another example of updating control state. In this example, the
value of a switch is sent to the backup process. There, in the event of a takeover, the
switch determines where processing is to continue by selecting the appropriate case.
Figure 27-3. Control State Example
VST134.VSD