Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 58
Creating and Starting the Backup Process
Creating and Starting the Backup Process
The primary process performs several activities related to initializing the backup
process. Specifically, it starts the backup process and opens it for interprocess
communication so that the primary process can send messages to the backup
process. The operating system is allowed to select the CPU in which the backup
process will run. To perform these activities, this example uses the following functions,
which are the same as those used in Active Backup Example 1.
Function primary_cpu, which returns the CPU number of the primary process
CPU. The CPU number is required by the MONITORCPUS procedure.
Function initialize_backup, which opens and starts the backup process;
called by function primary_processing.
Updating State Information
After the primary process completes its initialization tasks, it begins executing the main
processing loop. Code is added to the main processing loop to update file state
information in the backup process. This code is written as a separate function, named
update_backup, which is called by the primary process.
Function update_backup
Function update_backup does the following:
Calls backup_exists to make sure that the backup process exists; if not,
initialize_backup is called to recreate the backup process. See Active
Backup Example 1 for the listing and description of functions backup_exists and
initialize_backup.
Calls the C function __ns_fget_file_state to retrieve file state information for
the application input and output files and the standard output file.
Calls WRITEX to send the file state information to the backup process.