HPlogo Process Management Programmer's Guide: 900 Series HP 3000 Computer Systems > Chapter 2 Process Management Tasks

Deleting Processes

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

MPE/iX provides intrinsics that enable your program to delete itself and/or other processes. You may wish to delete a process because:

  • It has accomplished its task (use the TERMINATE or KILL intrinsics).

  • It has reached an error condition (use the QUIT or QUITPROG intrinsics).

When your program directs MPE/iX to delete a process, MPE/iX uses as algorithm to delete a process. When your program deletes a process, MPE/iX also searches for and deletes all of the process's descendants (children, grandchildren, and so forth ). In addition, the operating system accomplishes the following tasks:

  • All files opened by the process are closed and assigned the same disposition they had when opened (as if the FCLOSE intrinsic had been called with a disposition of zero).

  • All system resources reserved for that process (including the data area, process control block, and PIN) are returned to MPE/iX and made available for use by other processes.

The following sections describe how your program can delete itself and/or another process using these intrinsics:

  • TERMINATE

  • KILL

  • QUIT

  • QUITPROG

Deleting a Process with TERMINATE

Your program can call the TERMINATE intrinsic to delete itself. The following is an example of a TERMINATE intrinsic call:

   TERMINATE;

MPE/iX deletes the process by following the algorithm described in "Deleting Processes".

Deleting a Child Process with KILL (PH Capability Required)

If your program has PH capability, it can call the KILL intrinsic to delete a child process. An example of a KILL intrinsic call is:

   KILL (PIN);

PIN specifies the Process Identification Number of the child process to be deleted from the system. MPE/iX deletes the process by following the algorithm described in "Deleting Processes".

Aborting a Process

When your program has reached what you (the programmer) have defined as an error condition, you may wish to delete it from the system. In addition, you want to be notified that MPE/iX deleted the calling process in an error condition (aborted).

The QUIT intrinsic accomplishes this task by:

  1. Transmitting an abort message to $STDLIST

  2. Setting your job/session Job Control Word (JCW) to an error state

  3. Directing MPE/iX to delete the calling process, following the algorithm described in "Deleting Processes"

The following is an example of a QUIT intrinsic call:

   QUIT (NUM);

The NUM parameter is transmitted to $STDLIST as part of the abort message. You can use this number to assist you in determining the state of the calling process when the abort occurred.

In a session, your Root CI remains active even after the entire program finishes. In a batch job, the job terminates as soon as the entire program finishes, unless the :CONTINUE command is in effect.

Aborting the Entire User Process Structure

Your program can call the QUITPROG intrinsic to abort your entire user process structure (all processes below the Root CI). The QUITPROG intrinsic functions similarly to the QUIT intrinsic. The only difference is that when your program calls QUITPROG, MPE/iX deletes the entire user process structure (not just the calling process, as is the case with QUIT).

The following is an example of a QUITPROG intrinsic call:

   QUITPROG (NUM);

The NUM parameter is transmitted as part of the abort message to the calling process's $STDLIST. You can use this number to assist you in determining the state of the calling process when the abort occurred.

In a session, your Root CI remains active even after the entire program is aborted. In a batch job, the job terminates, unless the :CONTINUE command is in effect.

Feedback to webmaster