Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
OSS Porting Considerations
Open System Services Porting Guide520573-006
6-20
Directory Operations
Performance Considerations for Files
Because these OSS file operations consume more resources than the same
operations on other UNIX systems, note these recommendations:
Avoid performing numerous opens and closes of files and performing numerous
short reads and writes.
Consolidate operations when possible.
Avoid working with a great number of small files. (You will use the same amount of
resources to open a small file as a large file.)
The size of the data transfer on the OSS read() and write() function calls is
limited to 52 kilobytes.
If your UNIX program opens and closes a lot of files or executes a lot of scripts (which
usually contain a lot of commands, each possibly requiring a process creation), you will
have to solve a performance issue. As a result, you should redesign your program to
be less dependent on open and close file operations.
Directory Operations
A directory is a file which contains filename entries. In the OSS environment, directory
operations are similar to file operations. Directory I/O operations using the OSS
opendir() and readdir() function calls are buffered and cached. The opendir()
function opens the specified directory and associates it to a directory stream. A
directory stream acts as a handle to access the contents of a directory. The directory
stream attributes are inherited by the child process when using the fork() or
tdm_fork() function, but not when using the exec, tdm_exec, or tdm_spawn set of
functions.
However, the overhead on an OSS system tends to be higher than on some UNIX
systems because additional system processes are involved in the execution of these
function calls. See Performance Considerations for Files on page 6-20 for guidelines
on improving system performance.
Caching Considerations
A cache is a high-speed buffer storage that is continually updated to contain recently
accessed contents of a disk. Caching improves performance by reducing disk access
time in UNIX and OSS environments. Caching is standard to and used throughout the
UNIX system: for example, file and directory caching.
There are two types of file caching supported in the OSS environment: OSS name
server caching and data block caching. OSS name server caching improves file open
performance. Data block caching improves file I/O and disk I/O performance.