Number of Processes and Process ID Values on HP-UX

8
Poor aesthetics in output because of misalignment of columns when PIDs use more than the
expected five character positions.
Poor aesthetics in output because of wrapping around on the standard 80 columns, where it
did not previously do so, due to PIDs taking more than five character positions.
Running together of adjacent fields making output unreadable. For example, In
sprintf("%6d%6d%6d", x, pid, y) the values of the variables x and pid will run
together if the PID exceeds five digits.
Temporary File Name Parsing
Programs should never attempt to parse the temporary file names that are generated by functions such
as mktemp(3). The traditional decimal encoding of the caller’s PID value is not used when PID
values exceed five decimal digits.
Special PIDs
Process ID values should not be compared with any literal or symbolic constant. With one exception,
there are no documented special PID values.
The exception, as described in “Comparison Checks on PIDs” is for the system initialization process.
Additional Issues
pstat_getfile()
The pstat_getfile() function encodes only a 16-bit process index into one of its arguments. This
interface is obsolete. Programs must now use its replacement, pstat_getfile2().
shmctl()
Prior to HP-UX 11i v1 (B.11.11) the shmid_ds.shm_nattch and shmid_ds.shm_cnattch
fields as reported by shmctl(IPC_STAT,…) were 16-bit unsigned integers. This overflows if the
number of processes attached to a particular shared memory object exceeds 65,535.
It is unlikely for any application to have more than that number of processes sharing a memory
object.
4
Still, it is good practice to recompile any application that uses shmctl() on 11i v1 or later.
_CLASSIC_TYPES
The use of the _CLASSIC_TYPES compile-time switch is obsolete (since HP-UX 8.0). However, some
programs might still be using it. Such programs might encounter problems related to having PID
values reported in 16-bit fields.
Performance of Programs Using pstat_getproc()
Programs that use the pstat_getproc() function do so to obtain information about processes in the
system. If that information is stored, the data structures used should be evaluated for performance
and scaling. Also, consider increasing the buffer passed to this function, so that information for more
processes can be retrieved in each call (thereby decreasing the number of calls that are needed).
4
Because the 11i v3 documented maximum processes in the system (limit specified by the nproc kernel tunable parameter) is
60,000, indeed, very unlikely.