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

Interrogating Processes

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

MPE/iX provides intrinsics that enable your program to interrogate MPE/iX about the status of other processes. The process information you acquire can assist you in controlling your process structure. Process interrogation intrinsics are:

  • FATHER

  • GETPROCID

  • GETORIGIN

  • GETPROCINFO

  • PROCTIME

  • PROCINFO

Determining the Parent Process (PH Capability Required)

If your program has PH capability, it can call the FATHER intrinsic to determine the Process Identification Number (PIN) of its parent process. Following is an example of a FATHER intrinsic call:

   PARENTPIN := FATHER;

FATHER acts as a function to return to PARENTPIN the PIN of the parent process.

Determining a Child Process (PH Capability Required)

If your program has PH capability, it can call the GETPROCID intrinsic to determine the PIN of a child process. The following is an example of a GETPROCID intrinsic call:

   CHILDPIN := GETPROCID (NUMSON);

GETPROCID acts as a function to return the PIN of the child process specified by NUMSON. If NUMSON specifies a value greater than the number of current child processes, GETPROCID returns the PIN of the current child process that was created first.

  • If NUMSON = 0, GETPROCID returns the PIN of the first child created by the calling process.

  • If NUMSON = n (n > 0), GETPROCID returns the PIN of the nth child created by the calling process. For example, if NUMSON = 3, GETPROCID returns to CHILDPIN the PIN of the third child process created by the calling process.

Determining Source of Activation (PH Capability Required)

If your program has PH capability, it can call the GETORIGIN intrinsic to determine who activated it, the parent process or a child process. An example of a GETORIGIN intrinsic call is:

   ACTIVATIONSOURCE := GETORIGIN;

GETORIGIN returns one of the following codes to ACTIVATIONSOURCE:

0=

Neither the parent process nor a child process activated the calling process with an ACTIVATE intrinsic call

1=

The parent process activated the calling process

2=

A child process activated the calling process

Determining Process Priority and State (PH Capability Required)

If your program has PH capability, it can call the GETPROCINFO intrinsic to determine process management information about its parent process or a child process. GETPROCINFO acts as a function to return a value indicating:

  • Current state of the specified process (active or suspended).

  • Processes permitted to activate the specified process.

  • The type of process (parent or child) that called ACTIVATE to activate the specified process.

  • The priority class of the specified process.

  • The priority number in the master queue of the specified process.

This is an example of a GETPROCINFO intrinsic call:

   STATINFO := GETPROCINFO (PIN);

When PIN specifies 0, GETPROCINFO returns to STATINFO process management information about the parent of the calling process. For example, if the value $F0482 is returned to STATINFO, it is interpreted in the following manner:

BitsSettingMeaning
(31:1)0Process is currently suspended.
(29:2)01Only the parent process can activate the process.
(25:4)0000Not used.
(23:2)01The parent process last activated the process.
(20:3)010Process is in CS priority class.
(16:4)0000Not used.
(8:8)00001111Process has priority 15 in master queue.
(0:8)00000000Not used.

Determining Process Information

Your program can call the PROCINFO intrinsic to determine process management information. PROCINFO returns the same information as the GETPROCINFO intrinsic, as well as:

  • The PIN of the calling process

  • A value indicating the success or failure of the PROCINFO call, and, if unsuccessful, the nature of the error

Some of the information available through PROCINFO requires that your program have PH capability. For a list of capability requirements associated with each type of information available through PROCINFO, refer to the PROCINFO description in the MPE/iX Intrinsics Reference Manual (32650-90028).

Determining Accumulated CPU Time for a Process

Your program can call the PROCTIME intrinsic to determine the total amount of CPU time it has used since it was created. The following is an example of a PROCTIME intrinsic call:

   TIME := PROCTIME;

PROCTIME acts as a function to return to TIME the number of milliseconds your program has been in an EXECUTING state.

Feedback to webmaster