Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)

for all cross-processor pipe and FIFO I/O traffic. When you create a pipe across processors, you
have to communicate with the OSS pipe server in the processor that owns that pipe. This interaction
involves copying information between pipe buffers across processors, thereby using more system
resources.
If the child process is created in another processor, all pipe I/O by the child processes is handled
by the processor in which the parent process is running. This strategy requires interprocessor traffic
and incurs more system overhead than when the parent and child processes are running in the
same processor.
Despite the steps involved, using multiple processors has performance advantages such as load
balancing. If your code uses a lot of pipes between processors, be aware of the additional system
overhead.
Opening and Reading a FIFO File
Reading a FIFO file in the OSS environment also involves more system resources when done across
processors. Reading a FIFO is the same operation as reading a pipe—the only difference being
that a FIFO has a name in the OSS file system.
When you open a FIFO file, the OSS name server resolves the pathname for your OSS file open
request. When you open and read a FIFO across processors, there is more communication added
by the interaction between OSS pipe servers.
The following are the steps for opening a FIFO:
1. An application (client) uses a file open call for a FIFO called afifo. The open() function
sends a file open request to the OSS name server.
2. The OSS name server resolves the pathname and determines that it refers to a FIFO that is not
currently open.
3. The OSS name server picks an OSS pipe server and stores the processor number of the OSS
pipe server for the local opener.
4. The OSS name server sends a FIFO open request to the OSS pipe server.
5. The OSS pipe server creates a FIFO.
6. The OSS pipe server returns the FIFO’s ID to the OSS name server.
7. The OSS name server replies to the application with the FIFO’s ID. (The returned FIFO ID has
encoded within it the processor number of the OSS pipe server handling this FIFO—see step
3.)
Despite the overhead associated with dealing with pipes and FIFOs across processors, there are
often good reasons to distribute the processes across processors to improve the overall performance
and throughput of the application.
FIFO files cannot be created in the /G file system. However, Guardian processes can access FIFOs
using OSS API functions. Refer to the Open System Services Programmer’s Guide for information
on interoperability between Guardian and OSS processes using OSS API functions.
Performance Considerations for Pipes and FIFOs
Similar to the operations of opening, reading, writing, and closing files and directories, when you
create pipes and FIFO files you use more system resources in the OSS environment than in most
standard UNIX environments. Most of these operations involve the fork() function and the exec
set of functions, which, as described in “Using Process-Creation Calls” (page 96), involve the
management of copies of data in a multiple processor environment.
You can also increase performance by distributing processes across processors, despite the extra
overhead of dealing with pipes and FIFOs across processors. It all depends on the type of
applications that you are working with. When processes reside within a single processor, there is
no message system traffic. But when multiple processors are used, a message system I/O path is
created, which uses more system resources.
92 OSS Porting Considerations