[DBPP] previous next up contents index [Search]
Next: 5.7 Determinism Up: 5 Compositional C++ Previous: 5.5 Communication

5.6 Asynchronous Communication

  Recall that the need for asynchronous communication can arise when the   tasks involved in a computation must access elements of a shared data structure in an unstructured manner (Section 2.3.4). This   requirement can be satisfied in CC++ in three different ways:

  1. The shared data structure can be encapsulated in a set of specialized data tasks to which read and write requests are directed by using channel operations.

  2. The shared data structure can be distributed among the computation tasks. As discussed in Section 2.3.4, each computation task must then poll periodically for pending requests. For example, we can extend the Queue class of Program 5.6 to support a poll operation. The IntQData structure is augmented with a full/empty field, which is initialized to empty when a list element is created and set to full when a data value is placed in the list element. The poll function simply checks the status of this field in the list element at the head of the queue.

  3. A third implementation approach exploits CC++ 's RPC mechanism more directly. The shared data structure is distributed among the computation tasks. However, rather than sending a message on a channel, a task accesses data in another processor object by making an RPC to an appropriate member function. (The get_x function of Program 5.1 is a simple example of the sort of RPC we might write.)
The third approach is explored in a case study in Section 5.12.



[DBPP] previous next up contents index [Search]
Next: 5.7 Determinism Up: 5 Compositional C++ Previous: 5.5 Communication

© Copyright 1995 by Ian Foster