Concept MessagingProcessGroup

Contents

Description

A Messaging Process Group is a group of processes that can communicate by sending messages to each other. The method of transport for these messages is unspecified, as is the set of types that may be sent as messages. It is only guaranteed that messages sent before a synchronization will be available after the synchronization and that multiple messages sent from the same node to a single destination will be delivered in the same order they were sent.

Messaging process groups allow one to connect "handlers" that each have separate namespaces for message identifiers (tags). Handlers are responsible for processing messages during synchronization, and are typically used to maintain data structures that require communication to remain up-to-date.

Refinement of

Associated types

Concept tag PG::communication_category Must be convertible to synchronized_process_group_tag.
Message tag int Used to uniquely identify a kind of message.
Received array type pair<process_id_type, size_t> Used to describe an array that has been received.
Receivable message type optional<pair<process_id_type, int> > Describes a receivable message, if one exists.

Notation

PG
A type that models the Messaging Process Group concept.
T
A type that represents data to be send from one process to another.
pg
Object of type PG
id
Object of type PG::process_id_type
tag
Object of type int (the message tag type)
x
Object of type T
a
An object of type T[]
n
An object of type std::size_t that serves as the length of the array a
handler
A function object accepting a process_id_type and a message tag, which will receive the first message identified by these parameters.

Valid Expressions

Name Expression Type Semantics
Send message send(pg, id, tag, x) void Sends the given message x with tag tag to the process with ID id. send has local completion semantics and will not block.
Send array send(pg, id, tag, a, n) void Sends the given message array a with n elements and tag tag to the process with ID id. send has local completion semantics and will not block.
Receive message receive(pg, id, tag, x) Convertible to process_id_type Receives a message with tag tag and stores the value into x. The message will come from process id and id will be returned. This routine requires that probe be able to return a message from id with tag tag.
Receive message from any sender receive(pg, tag, x) Convertible to process_id_type Receives a message with tag tag and stores the value into x. The message may come from any sender, and the ID of the sender will be returned. This routine requires that probe be able to return a message from some sender with tag tag.
Receive array receive(pg, id, tag, a, n) Received array type Receives a message with tag tag and stores the values (up to n of them) into array ''a''. The message will come from sender 'id'. A pair of id and the number of elements stored will be returned. The preconditions are equivalent to those of the non-array receive.
Receive array from any sender receive(pg, tag, a, n) Received array type Receives a message with tag tag and stores the values (up to n of them) into array ''a''. The message may come from any sender. The sender ID and the number of elements stored will be returned. The preconditions are equivalent to those of the non-array receive from any sender.
Query receivable message. probe(pg) Receivable message type If a message is immediately available, returns the ID of the sender and the message tag. Otherwise, returns an empty optional. This operation has local completion semantics. The set of messages that probe may return includes all messages sent before the last synchronization but not yet received. It may include messages sent after the last synchronization.
Synchronize synchronize(pg) void Ensures that all messages sent before the synchronization can be probed and received. Any messages bound for a handler will be passed to that handler during this call. This operation has remote completion semantics, requiring the coordination of all processes.
Construct and attach handler PG(pg, handler) PG Constructs a new copy of the process group pg that coordinates with all other copies of pg but has its own space for message tags. The handler is responsible for receiving messages within this space during synchronization.
Replace handler. pg.replace_handler(handler) void Replace the handler of this process group with a new one.
Access primary process group pg.base() PG Return a copy of the process group that is not associated with any handler.

Models


Copyright (C) 2004-5 The Trustees of Indiana University.

Authors: Douglas Gregor and Andrew Lumsdaine