HP 3000 Manuals

Creating a Process (PH Capability Required) [ Process Management Programmer's Guide ] MPE/iX 5.0 Documentation


Process Management Programmer's Guide

Creating a Process (PH Capability Required) 

If your program has PH capability, it can call the CREATEPROCESS
intrinsic or the CREATE intrinsic to create a child process.  Both
intrinsics direct MPE XL to:

 *  Initialize resources

 *  Allocate a private data area (including a stack)

 *  Load the specified program into virtual memory

 *  Assign a Process Identification Number (PIN)

 *  Place the newly created child process in a suspended state (see
    Figure 1-2)

CREATEPROCESS is the recommended intrinsic for process creation because
it is designed to be more flexible and extendable than the CREATE
intrinsic.

Using CREATEPROCESS 
Your program can call the CREATEPROCESS intrinsic to create a child
process.  Your program can control the creation of the child process with
the optional parameters itemnums and items.  The information you can pass
to MPE XL through itemnums/items parameter pairs include:

 *  The names of the files to be used as $STDIN and $STDLIST for the
    child process.

 *  An option that indicates if the child process is to be activated
    immediately after it is created, and if the parent process should be
    suspended automatically when the child process is activated.

 *  A list of user-named executable libraries to be searched at load time
    for required external references.

 *  A user-created UNSAT procedure, to which all unsatisfied load-time
    external references may be directed.

This is an example of a CREATEPROCESS intrinsic call:

          .
          .
          .
     ERRORCODE := 0;
     PIN := 0;
     BNAME := 'MYPROG.PUB.MYACCT';
     ITEMNUMS[1] := 3;
     ITEMNUMS[2] := 0;
     ITEMS[1] := 1;
     CREATEPROCESS (ERRORCODE,PIN,BNAME,ITEMNUMS,ITEMS);
          .
          .
          .

The parameters specified in the example above are described below.

ERRORCODE        Returns a value that indicates the success or failure of
                 the CREATEPROCESS call, and, if unsuccessful, the nature
                 of the error.

PIN              Returns the PIN of the newly created child process.

BNAME            Passes the name of the program file the child process is
                 to execute.

ITEMNUMS         Passes the value 3 in the first element of the array
                 indicating that load option information is passed in the
                 first element of the array ITEMS. The value 0 in the
                 second element indicates the end of the option list.

ITEMS            Passes the value 1 in the first element of the array
                 indicating that the calling process is to be reactivated
                 when the child process is deleted.

Using CREATE 

Because the CREATE intrinsic allows your program only limited control
over the creation of a child process, it offers a subset of the
parameters available with the CREATEPROCESS intrinsic.

This is an example of a CREATE intrinsic call:
          .
          .
          .
     BNAME := 'MYPROG.PUB.MYACCT';
     PIN := 0;
     LOADFLAGS := 1;
     CREATE (BNAME,,PIN,,LOADFLAGS);
          .
          .
          .

The parameters specified in the example above are described below.  All
other optional parameters are omitted.

BNAME            Passes the name of the program file the child process
                 executes.

PIN              Returns the Process Identification Number (PIN) of the
                 child process.

LOADFLAGS        Passes load option information.  The value 1 specifies
                 that the calling process is reactivated when the child
                 process is deleted.


MPE/iX 5.0 Documentation