Open System Services Programmer's Guide

facility; individual threads are not independently dispatched (that is, not “kernel” threads), so only
one can be active on a processor at a time. There are no facilities to checkpoint a hidden pthread
state.
Designing, implementing, and testing a correct OSS process pair is not a simple task. Often it is
preferable to use middleware subsystems that provide the necessary fault-tolerance features.
However, sometimes a tailored process pair is the best or most efficient mechanism. For more
information about process-pair programming, see the Fault-Tolerant Programming in C chapter in
the Guardian Programmer's Guide.
One reason to use an OSS process pair is to ease interactions with other OSS processes in a
multi-process OSS application. For example, an OSS process opens OSS files for stdin,
stdout, and stderr streams. Some functions, such as freopen(), do not interoperate between
OSS and Guardian files; even freopen_oss()does not permit a Guardian process to reopen
a Guardian stdout stream as an OSS stream.
OSS Process Pair Creation
Beginning with the J06.14 and H06.25 RVUs, the PROCESS_SPAWN_ procedure accepts the
value ZSYS_VAL_PCREATOPT_CALLERSNAME (3) in the z_nameoptions (also known as
pe_name_options) field of the process-extension parameter to create an OSS backup
process. The z_processname (pe_process_name) field is ignored and should be NULL (zero,
the default). The caller must be a named OSS process. The first parameter, oss-program-file
(the pathname), is typically absent or null, so that the backup process runs the same program as
the primary.
NOTE: The PROCESS_SPAWN_ procedure takes several parameters that are pointers to structures,
which are defined in both the tdmext.h header file and the ZSYSDDL family of header files
(including ZSYSTAL for TAL/pTAL and ZSYSC for C/C++). The process-extension structure
has members with names pe_... defined in tdmext.h. The member called pe_name_options
is also called Z^NAME^OPTIONS in ZSYSTAL and z_name_options in ZSYSC.
ZSYS_VAL_PCREATOPT_CALLERSNAME is defined in ZSYSC but not in tdmext.h. For details
about these structures and other PROCESSS_SPAWN_ parameters, see the Guardian Procedure
Calls Reference Manual.
Because the process is created with PROCESS_SPAWN_, it has Guardian ancestry, and not OSS
ancestry.
OSS Process Attributes
The characteristics of processes in OSS process pairs are:
Both the primary and backup processes have the same process name.
The PROCESS_GETPAIRINFO_ procedure works the same as it does for Guardian.
The program can reside in either the Guardian or the OSS file system.
Each process has its own PID, just as it has its own CPU, PIN identity.
The primary and backup processes communicate the same way as usual, using (Guardian)
opens of the backup process in the primary and $RECEIVE in the backup.
If the OSS process pair implements a server, the primary also opens $RECEIVE and reads
client requests from it.
To enable automatic message switching, $RECEIVE must be opened with receive depth greater
than 0.
OSS Process Pairs 159