Setting _BPX_SHAREAS and _BPX_SPAWN_SCRIPT
- Set _BPX_SHAREAS to YES. (REUSE is the same as YES.) The shell will run foreground processes in
the same address space as the shell is running in, which saves the overhead of a fork() and
exec().To improve performance for all shell users, /etc/profile or $HOME/.profile should set BPX_SHAREAS=YES as follows:
The spawn() runs faster, the child process consumes fewer resources, and the system can support more resources. However, when running multiple processes with BPX_SHAREAS=YES, the processes cannot change identity information. For example, setuid() and setgid() will fail. You cannot execute setuid() or setgid() in the same address space as another process. Also, when the parent ends, the child will end because it is a subtask.
If the extended attribute for the shared address space is not set, the program will not run in a shared address space, regardless of the setting of _BPX_SHAREAS. The attribute is set by extattr +s and reset by extattr -s. If the attribute is set, _BPX_SHAREAS has precedence.
- To improve performance when running the shell scripts, set _BPX_SPAWN_SCRIPT to YES. The spawn()
service will run files that are not in the correct format to be either an executable or a REXX exec as shell scripts directly from the
spawn() function. Because the shell uses spawn() to run foreground commands, setting this variable
to YES eliminates the additional overhead of the shell invoking fork after receiving ENOEXEC for an
input shell script.To provide this performance benefit to all shell users, set the environment variable in /etc/profile or $HOME/.profile:
However, there might be exceptions, depending on your environment.