Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
Extra Steps for Creating Files
The extra steps for opening OSS files involve the pathnames translation performed by the OSS
name server. The catalog accessed is an Enscribe database describing the files in the fileset. Each
OSS fileset has a catalog. For the OSS fileset, each OSS file has an entry in a catalog, as does
each filename.
Creating a file involves a few more steps than opening an existing OSS file. Similar to opening a
file, the application (client) sends an open request to the OSS name server, which determines that
the file does not exist. The OSS name server picks a volume and creates a file by sending an OSS
create call to the DP2 disk process; it creates a catalog entry for the file and responds to the
application with the created filename. The application then can open this file by sending an OSS
open request to the DP2 disk process.
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” (page 101) 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.
Performing File Operations 101