p4 tries to be as flexible as possible about how processes will be
started. It is assumed that the user executes a command in response to a
system prompt. Depending on the particular environment, this may start a
large number of processes or may start a single process, which in turn will
start others. The precise disposition of processes (the machines they will
run on, the executable files, and the grouping into clusters of processes that
share memory) is usually specified in a ``process group file,'' or ``procgroup
file'' for short. The name of the procgroup file is typically a command-line
argument to a p4 application, and the function p4_create_procgroup, called by the initial or ``master'' process, reads the
file and starts up the collection of p4 processes. Since a user may
wish to obtain the information normally specified in the procgroup file in his
own way, access is also provided to the data structures normally filled in by
p4_create_procgroup; in this case p4_startup is called to start
the processes based on these data structures. On machines where all processes
are started externally at the same time, the p4_create_procgroup
performs necessary initialization, after which the ``master'' process can join
in the general computation, as in the example in Section
.
Thus p4 can be used to program in the ``SPMD'' model (single program,
multiple data) as well as in the ``master-slave'' model.
All p4 programs must execute a p4_initenv call before any other p4 calls; in particular, a process does not have a p4 process id--an integer between 0 (the initial process) and one less than the total number of processes--until it has executed p4_initenv. Then p4_get_my_id returns a process's own p4 identifier.
Recently an experimental graphical user interface has been constructed to make
it easier to run p4 programs. It is shown in Figure
.
It dynamically locates workstations on the network and makes it easy to
construct a valid procgroup file and then run a p4 application with just
a few mouse clicks. This system was easily built using
Tcl/Tk [24].