Comparing: Blocking and non-blocking communications



Blocking routines

Blocking means that routines only return once communication completes, or when the user buffer can be used or re-used.


Non-blocking routines

Non-blocking sends. As communication is a relatively slow process blocking is an inefficient way to send messages. In non-blocking communication the routine returns before communication is complete. Communication continues in the background whilst other work is performed.


Non-blocking communication in MPI

Non-blocking calls have the same argument list as blocking routines apart from an additional argument. This argument - REQUEST - provides a handle which may be used to check when communication completes.


Waiting for communication to complete in MPI

When using non-blocking routines it is essential to ensure that communication has completed before using the results or re-using the buffer.

MPI_WAIT(REQUEST,STATUS, IERROR)
This routine blocks until the communication specified by the handle REQUEST has completed.


Testing for communication completion in MPI

MPI_TEST(REQUEST,FLAG,STATUS,IERROR)
This routine enquires if the communication specified by REQUEST has completed. The result (TRUE or FALSE) is returned in FLAG.

Non-blocking receive in PVM

The routine
pvmfnrecv(tid, msgtag, bufid)
is non-blocking in the sense that it returns immediately either with the message or with information that the message has not yet arrived.

If the requested message has not arrived, then

bufid=0.

PREVIOUS NEXT
UP


Submitted by Mark Johnston,
last updated on 10 December 1994.