Number of Processes and Process ID Values on HP-UX
10
Testing
After any program source code update, it is always necessary to validate it for proper operation.
That validation should be carried out in the expected operational environments. The following
sections describe how to set up environments with large PIDs or with a large number of processes in
order to adequately validate updates to support such environments.
Testing Large PIDs
To validate that programs properly handle large PID values, HP-UX 11i v3 adds the ability to make all
PID values large. To do so requires that the system tunable parameters process_id_min and
process_id_max be set to large values (for example, 1000000000 and 1070000000,
respectively). With these settings, programs can be validated in an environment where all processes
have large PID values.
5 6
It is recommended that a reboot be done after setting these parameters, so
that all existing processes are re-created with larger PIDs. For more information, see the associated
manpages.
Testing Large Numbers of Processes
To validate that programs properly handle large numbers of processes requires that a small program
be written to create lots of processes. The program being validated can then be executed once those
processes are created. The following example is an outline of such a program:
// sample program to create 50626 processes
// the program can be stopped by sending
// SIGTERM signal to main process
sig_handler() {
relay SIGTERM to all my child procs
exit
}
create_children()
level++
if (level < 4) {
setsid() // start new process group and session
for 15 iterations {
fork()
if child {
create_children()
}
if parent {
record child pid for later
}
}
for 15 iterations {
// children will exit on SIGTERM
wait() for children
}
exit
}
5
Except for certain kernel system processes, which always have very low PID values.
6
For some programs, it may be valuable to also test in environments where some PID values are very small and some are very
large. For these, create some test processes before and after increasing process_id_min, and don’t reboot before
completing the tests.