Process Management [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Developer's Kit Reference Manual Volume I
Process Management
This section provides an overview of implementation considerations that
you must understand when creating and managing processes as they are
implemented in the POSIX/iX library. For more information about how
processes are created and managed in a POSIX.1 environment, refer to
chapter 6, "Process Creation and Synchronization", in The POSIX.1
Standard - A Programmer's Guide (36430-90003).
The implementation and behavior of processes created through the POSIX/iX
library conform in most respects to the POSIX.1 standard. In most cases,
underlying MPE/iX process features are transparent to a POSIX.1
application; however, there are some MPE/iX features outside the scope of
the POSIX.1 standard that cannot be hidden from your application. These
additional implementation features must be taken into account when you
are creating and managing processes through the POSIX/iX library.
NOTE Users need PH capability when running a program in an HFS directory
that spawns childprocesses.
Creating a New Process
The following implementation considerations must be understood when using
fork() or an exec() function to create or execute processes.
* The executable file must have an MPE/iX file code of NMPRG.
* The MPE/iX process handling (PH) capability must be appropriately
assigned. Process handling capability is described in the section
"MPE/iX Process Handling Capability."
An executable file that is compiled and linked using the c89 command
(available through the MPE/iX Shell) always creates an executable file
with an MPE/iX file code of NMPRG. Attempts to use an exec() function to
execute a file that has a file code of anything other than NMPRG results
in an error, with errno set to ENOEXEC.
To determine whether a file has an MPE/iX file code of NMPRG, you must
use the MPE/iX CI command LISTFILE. For more information about using the
LISTFILE command, refer to MPE/iX Commands Reference manual.
MPE/iX Process Handling Capability.
By default, MPE/iX restricts an application's ability to spawn multiple
processes. The MPE/iX process handling (PH) capability allows the
creation of multiple processes.
There are two levels of restrictions that apply if an application wishes
to invoke the fork() function or exec() functions:
* The executable file must be linked with PH capability. The c89
command available through the MPE/iX Shell automatically assigns
PH capability to files at link time.
* If the executable file resides in an MPE/iX group, that group must
have PH capability in order to execute the file. PH capability is
assigned by a user with either SM or AM capability to an MPE/iX
group using the MPE/iX CI commands NEWGROUP (when the group is
created) or ALTGROUP (when the group exists).
* If an executable file is located in a hierarchical directory, the
user attempting to execute the file must have PH capability
assigned using the ALTUSER command.
Inherited Process Attributes.
Because processes created through POSIX/iX library functions reside in an
MPE/iX process environment, certain MPE/iX process attributes are
inherited by a process created by fork(); however, these MPE/iX process
attributes are not visible in the POSIX/iX environment.
For example, the following MPE/iX process attributes are inherited by a
new process created by fork():
* process priority
* capabilities
* stack size
* heap size
Also, some MPE/iX process attributes that are not defined by the POSIX.1
standard are not inherited by the child process. The lack of these
attributes does not affect the behavior of a process created in the
POSIX/iX environment.
Process Termination
On MPE/iX, if a parent process terminates without waiting for all of its
child processes to terminate, the resulting "orphaned" child processes
are terminated immediately prior to termination of the parent process.
The implementation does not allow orphaned child processes to be adopted
by a system process. Your application should not rely upon orphaned
child processes being adopted by a system process.
Additional Implementation Considerations
No user process can be a controlling process. Only system processes,
such as the MPE/iX Command Interpreter (CI), are allowed to be
controlling processes.
The controlling terminal is not disassociated from the session when a
user process terminates. The controlling terminal is associated with the
MPE/iX CI session that invokes the application. The controlling terminal
is only disassociated when the MPE/iX session is ended (when the user
logs off the system using the BYE command).
CPU time accounting information accrued by process is not made available
to the parent process through the wait() and waitpid() functions. A zero
is always returned.
Attempts to use the fork() or exec() function to create a new process
fails if the calling process
* has active switches to MPE/iX compatibility mode (CM) code
* has set critical mode
* has outstanding NOWAITIO
* is holding an operating system internal resource (SIR)
MPE/iX 5.0 Documentation