COBOL Manual for TNS and TNS/R Programs

Fault-Tolerant Processes
HP COBOL Manual for TNS and TNS/R Programs—522555-006
32-5
Process Pairs
In this primary-plus-backup structure, the fault-tolerant facility (as directed by the
primary process) keeps the backup process informed of the executing state of the
primary process. At critical points in the processing, the primary process sends
checkpoint messages to the backup process to pass the current state of the data, the
file buffers, and the files to the backup process. When the backup process learns of the
failure of its primary process (by the receipt of a process-failure or processor-failure
system message through $RECEIVE), the backup process becomes the primary
process and continues with the application’s work (possibly starting a new backup
process for itself).
The fault-tolerant facility provides the means of writing application programs that can
recover from a processor module failure. When the primary process executes a
STARTBACKUP statement, a fault-tolerant facility routine in the primary process
directs the operating environment to start the backup process.
When the primary process executes a CHECKPOINT statement, a fault-tolerant facility
routine transmits pertinent data to the backup process. While the primary process is
operating, a fault-tolerant facility routine in the backup process automatically monitors
and accepts checkpoint information from the primary process. If the backup process is
notified of the failure of its primary process, the fault-tolerant facility causes the backup
process to begin executing at the statement following the latest CHECKPOINT
statement. (The notification to the backup process of the failure of the primary process
comes in the form of a processor-down, stop, or abend message delivered through
$RECEIVE and handled automatically by the HP COBOL fault-tolerant facility.)
Figure 32-2 illustrates the activity of a process pair. The backup process stays in
monitor state while the primary process is operating. If the primary fails, the backup
leaves the monitor state and begins executing at the point indicated by the last call to
CHECKPOINT by the primary.
Figure 32-2. Activity of a Process Pair
"backup"
monitor
primary
READ
...
READ ...
update ...
CHECKPOINT
WRITE
...
OPEN files
STARTBACKUP process
READ entry from terminal
READ record from disk
update record in memory
CHECKPOINT
WRITE updated record to disk
"primary"
VST717.vsd