Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
The process acting as the requester must use the FILE_OPEN_ procedure to open a communication
channel to the named server process. A named OSS process can be created by:
• Using tdm_fork(), tdm_execve(), or tdm_spawn() from another OSS process
• Using the PROCESS_SPAWN_ procedure from a Guardian process
• Using the run command within the OSS shell
• Using the osh command with the -name option from the Guardian environment
When $RECEIVE is used, system messages can arrive on it; the program must be prepared to deal
with them. The server or requester can be an OSS process. It is common for the requester/server
relationship to be that the requester opens the server and writereads to the server. The server
manages the opens issued by the requester. Sample programs using $RECEIVE are included in
the Open System Services Programmer’s Guide.
Using FIFOs
Guardian and OSS processes can communicate through FIFOs because a FIFO has a name that
both processes can see and open. The Guardian process must open the FIFO using the OSS C
fopen() function because the FIFO exists in the OSS file namespace.
Using Files
Guardian and OSS processes can share a file. The file can be an OSS file or a Guardian file and
can be accessed through Guardian procedures or C functions in a Guardian program. In an OSS
program, the file can be accessed using a C run-time function. If one process completes the writing
of a file before the other process reads the file, no synchronization problems occur. However, if
the Guardian and OSS process wish to share the file at the same time, a synchronization method
must be used. Guardian file locking for Guardian files and OSS file locking for OSS files can be
used to synchronize access. Guardian semaphores are another mechanism that can be used,
because Guardian semaphores can be invoked in both Guardian and OSS programs. See the
Guardian Programmer’s Guide for further information on communicating using files.
Using Queue Files
The use of queue files is a particularly efficient mechanism for communication between OSS
programs and Guardian programs. A queue file is a special file that can be written by multiple
writers and read by multiple readers, in a first-in, first-out order. This is particularly useful for the
construction of parallel servers, each running in a separate processor, reading requests from one
centralized queue and servicing them in the order that the requests are written to the queue. The
Guardian DP queue file provides the synchronization mechanism itself. Along with the performance
and ease of programming advantages comes the disadvantages that they lack any management
and fault tolerant features.
Using Shared Memory
In the Guardian environment, both flat and selectable memory segments can be created and
shared. Guardian processes can share and synchronize access to memory using Guardian shared
memory and semaphore functions. OSS processes can share and synchronize access to memory
with other OSS processes using OSS shared memory and semaphore functions. The shared memory
segments created and managed by OSS shm*() functions are distinct from segments created by
the Guardian SEGMENT_ALLOCATE_ and related procedure calls. Both kinds of segments can be
created and shared, but one kind cannot be shared with the other.
Both Guardian and OSS processes can call SEGMENT_ALLOCATE_ and related Guardian
procedure calls: they can share segments as described for SEGMENT_ALLOCATE_.
Beginning with the H06.20 and J06.09 RVUs, 64-bit addressable memory is available for native
Guardian processes by the use of the SEGMENT_ALLOCATE64_ procedure. For information about
150 Migrating Guardian Applications to the OSS Environment