next up previous
Next: Threads Up: Processes and basic parallel Previous: Processes

Routines

The basic parallel process calls are send and receive, with a syntax something like

send(&x, dest_id);
recv(&y, source_id);

These messages maybe sent synchronously or asynchronously. Synchronous message passing is when routines return after the message transfer has been completed. Thus, a request to send is transferered from process 0 to process 1, an acknowledgement immediately sent back, and the data transferred.

There are so-called blocking and non-blocking message passing approaches also. A message buffer must be created to hold data between the send and receive. Blocking routines are routines that return only after their action is complete (even if the message transfer may not be completed). If the routine returns immediately, the routine is nonblocking.

For example, process 0 may issue a send, pack data into the buffer, and push the buffer out. But the message cannot be received until process 1 issues the appropriate receive. Process 0 may be idling while waiting for the recv.

Other common messages are gather and scatter. Gather pulls in pieces of an array from different processes, and scatter pushes pieces out.

We will talk in greater detail later about the MPI message passing library. To start, however, we consider the shared memory set-up.



E. Bruce Pitman
Mon Oct 2 10:36:05 EDT 2000