A program compiled with +Oparallel
for parallel execution uses shared memory segments and additional
processes when it executes. Except in rare circumstances, the program
will terminate the processes and free the shared memory whether
it completes normally or terminates because of a signal.
However, if enough parallel programs do not terminate their
additional processes over a period of time, you may get messages
indicating that the operating system refuses to start another process
when you attempt to run any program. fork()
returns the error value [EAGAIN] (resource temporarily unavailable),
which in this case means that the system's limits on the
number of system-wide or individual-user processes would be exceeded.
If this should happen, you can use the ps -f
command to search for the processes that didn't terminate
and the kill command to terminate them (see
ps(1) and kill(1)).
Note that the ps -f command displays the
same name for the processes as it does for their associated main
programs.
Likewise, if enough parallel programs happen not to free their
shared memory segments over a period of time, programs may start
failing because of insufficient memory, either shared or normal.
Terminating the additional processes will almost certainly free
the shared memory segments as well. If not, you can use the ipcs -m
command to search for shared memory segments and the ipcrm
command to remove them (see ipcs(1) and ipcrm(1)).
Note that the ipcs -m command lists the same
owner and group for the shared memory as the associated parallel
program had and that most systems normally have active shared memory
segments owned by root and daemon.