Message queue management


Up: Contents Next: Miscelleous Routines Previous: Noncontiguous and Heterogeneous

A number of

The major interfaces used are

MPID_Search_unexpected_queue
Look for a message that matches the (tag,context_id,source) in the unexpected queue. This is used for probe operations.
MPID_Search_unexpected_queue_and_post
If not found in the unexpected queue, add to the posted receive queue
MPID_Msg_arrived
Check the posted receive queue; if not found, add to unexpected queue

These interfaces have been designed to simplify a thread-safe implementation. For example, the MPID_Search_unexpected_queue_and_post needs to be an atomic operation; if it is not and is implemented as
MPID_Search_unexpected_queue 
   if (not found) 
      MPID_Enqueue( posted_receive_queue ... ) 
then if another thread delivers the message after the unexpected queue is checked but before the MPID_Enqueue is called, the message will be lost (inserted by the second thread into the unexpected queue). The MPID_Msg_arrived is essentially the reverse of MPID_Search_unexpected_queue_and_post.



Up: Contents Next: Miscelleous Routines Previous: Noncontiguous and Heterogeneous