GDSX Manual

Design and Development
Extended General Device Support (GDSX) Manual134303
2-31
Checkpointing
pool.) If the message indicates that the file is in the same state (open or closed) in the
primary and backup processes, no action is taken. If the state is not the same, brother
opens or closes the file as appropriate. (In case brother cannot open the file, it replies to
the primary with a file number and the Guardian file error number returned from OPEN.
The primary issues an appropriate message and stops the backup process.)
Checkpointing User Global Data
Checkpoints including both global data and task stack are accomplished by the
following technique:
INT I^GOT^CP^SE M;
I^GOT^CP^SEM := GET^CPSEM;
CALL Q^CP(...); !As many as required to checkpoint globals
IF ^CHECKPOINT( ) THEN ! either type 1 or type 2
BEGIN
I^GOT^CP^SEM := 0;
.
Do takeover processing
.
END
ELSE
IF I^GOT^CP^SEM THEN
BEGIN
CALL GIVE^CPSEM;
I^GOT^CP^SEM := 0;
END;
Q^CP queues the global data in the checkpoint buffer (of size MAXCPSIZE). The call
to ^CHECKPOINT is used to queue the task’s stack image and TCB (and the task’s
allocated memory pool buffers if it is a type 2 checkpoint) in the checkpoint buffer and
to send the data to the backup process. The call to ^CHECKPOINT establishes a restart
point at the instruction following the call.
Note that this example synchronizes the checkpointed globals with the state of the
calling task, but does not guarantee that the globals will be synchronized with the states
of other tasks. Synchronization of the globals with other tasks depends on the
application’s design.
For example, suppose task A checkpoints a global list and its stack image and then adds
item x to the global list. Then task B adds item y to the list and checkpoints the global
list and its stack image. If there is a takeover, item x is included in the list, but task A
tries to add it again.
Type 1 Checkpoint
When a user task does a type 1 checkpoint, the following actions occur. Note that
before CHECKPOINT(1) is called by a task, global data may have been put in the
checkpoint buffer by call(s) to Q^CP[X].
1. The semaphore cpsem is acquired.