Guardian Programmer's Guide

Table Of Contents
Fault-Tolerant Programming in C
Guardian Programmer’s Guide 421922-014
27 - 9
Primary Process Organization
application processing phases are essentially the same as for the primary process; that
is, the backup process (once it becomes the new primary process) must also create a
backup process and execute the application. The message-processing loop monitors
and processes messages received from the primary process and CPU.
Primary Process Organization
A process executing as the primary process proceeds as follows:
Initialization Phase
During the initialization phase, the primary process does the following:
1. Calls __ns_start_backup to start and initialize the backup process, typically in
another CPU. The backup process is given the same name as the primary
process.
2. Opens the backup process by calling FILE_OPEN_ so that the primary process
can send messages to the backup process. The messages contain the current
state information.
3. Opens any files required for its execution.
4. Calls __ns_fget_file_open_state to get open state information for the files it
just opened, and then sends the information to the backup process. The primary
uses interprocess communication (for example, WRITE[X]) to write the state
information to the backup process, which receives it through $RECEIVE.
The primary process can now begin processing the application.
Application Processing Phase
During application processing, the primary process does the following:
At critical points during execution, sends updated state information to the backup
process. The information includes control state, application state, and file state
information. The primary process gets file state information by calling
__ns_fget_file_state, and then uses interprocess communication (for
example, WRITE[X]) to write all the state information to the backup process, which
receives it through $RECEIVE.
Note that each state update message must completely define a continuation point
in the backup process.
Monitors the backup process. If the backup process fails, the primary process
should start a replacement backup. To monitor the backup process, the primary
process can use one of several methods, as described later in this section under
Monitoring the Backup Process.