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

Table Of Contents
OSS Porting Considerations
Open System Services Porting Guide520573-006
6-12
Virtual Memory Management
An attempt is made to use memory that has already been freed.
Virtual Memory Management
The Kernel-Managed Swap Facility (KMSF) manages virtual memory for TNS/R and
TNS/E native processes. Native processes use kernel-managed swap space rather
than a user-specified swap file. The global data, heap, main stack, and SRL or DLL
instance data are swapped to system-managed swap files for native processes. The
space guarantee attribute (pe_space_guarantee) of a process can be used by
KMSF to reserve space in system swap files. If the requested space is not available at
process creation, an error is returned, and the process is not started.
For more information on KMSF, refer to the Kernel-Managed Swap Facility (KMSF)
Manual.
Considering Design Trade-Offs
Because of the way in which some of the UNIX features are implemented in the OSS
environment, there may be some performance implications in using these features.
The NonStop operating system uses a loosely coupled multiprocessing architecture;
therefore, different design alternatives might need to be considered in porting UNIX
programs to the OSS environment.
When you must modify code to move it to another environment, you weigh standards
and portability against extensions and performance. If your main priority is portability,
you should conform to the POSIX standards as much as possible. If your program can
use a standard set of interfaces, follow the XPG4 specifications because most UNIX
platforms conform to them.
If performance is a priority, consider the changes discussed under Using Interprocess
Communication (IPC) Mechanisms on page 6-3. Then consider using some of the HP
extensions, which take advantage of the NonStop system architecture. For example,
you can use almost all the Guardian procedure calls in your C program in the OSS
environment. However, the more you use the HP extensions and Guardian procedures,
the less portable your program becomes to other UNIX environments.
If you use the HP extensions, do one of the following:
Put the system-dependent code in isolated modules where possible. This practice
allows you to replace the isolated code in future porting. You can use the make
utility to build and link in the correct modules for the environment in which your
program will run. See Using HP Extensions on page 7-25, which discusses placing
extensions in separate modules to get both portable code and high performance.
Use the conditional compilation feature (#ifdef and related feature-test macros)
of the HP C compiler for NonStop systems to create a program that contains the
system-dependent code only when the program is compiled for execution on a
NonStop system. This practice allows you to write and maintain portable cross-
platform code when your site has the same application on systems running