Prism 6.0 User's Guide

Interrupting and Waiting for Processes

It is useful in debugging message-passing programs to wait for a specific process or set of processes to stop executing, or to be able to interrupt execution of individual processes. Because message-passing programs are distributed among multiple, separate machines, extra consideration must be given to controlling selected subsets of processes. MP Prism therefore provides the commands interrupt and wait.

Use the interrupt command to forcibly interrupt execution of a specified process or set of processes. The MP Prism term for a set of processes is pset. For information about psets, see "Using Psets in MP Prism".

For example,

interrupt pset 0

interrupts execution of process 0.

interrupt pset running

interrupts all processes in the predefined process set (pset) running.

Using the interrupt command resets the predefined pset interrupted so that it includes the newly interrupted processes. Processes leave this pset when they continue execution.

In MP Prism, the Interrupt selection from the Execute menu interrupts processes in the current pset that are running.

Use the wait command to wait for a specified process or processes to stop execution. A process is considered to have stopped if it has entered the done, break, interrupted, or error state.

There are two versions of the wait command:

(prism notx) wait every

waits for every process in the pset notx to stop. The current process will be whatever it would normally be; see " Current Pset". This is the default behavior of the wait command.

wait any pset foo

waits for the first process in pset foo to stop.

There are corresponding Wait Any and Wait Every selections in MP Prism's Execute menu. They apply to the processes of the current set.

You can end the wait by

Note that, if you prefer that step and next commands wait for processes to finish executing before letting you issue other commands, you can issue them along with the wait command. For example,

step; wait

This says: Execute the next line, then wait for all processes in the current pset to finish execution.

If you use this command sequence frequently, you can provide an alias for it via the alias command. Prism provides the default alias contw for these commands:

cont; wait