Summary


This chapter has described three different kinds of message-passing mechanism. In synchronous message passing, the sender of a message is blocked until it is received. In asynchronous message passing, the sender continues after sending. Messages that have been sent and not received must be buffered. The buffering requirement of asynchronous message communication is potentially unbounded. In rendezvous, a two-way message-passing protocol provides for client – server interaction. Selective receive provides a way of implementing guarded actions in message-passing systems.

To illustrate message-passing programs, we developed three different abstractions: the Channel for synchronous message passing, the Port for asynchronous message passing and the Entry for rendezvous communication. The implementation relationship between these classes is summarized in the class diagram of Figure 10.13. In constructing Entry directly from Port we have deliberately ignored good object-oriented programming practice in the interests of simplicity. The problem we have ignored is that it is possible to invoke both send() and receive() methods on Entry objects. A more robust implementation would introduce a port implementation class with protected send and receive methods which would be used by both Port and Entry to implement their public interfaces.

image from book
Figure 10.13: Message-passing classes.




Concurrency(c) State Models & Java Programs
Concurrency: State Models and Java Programs
ISBN: 0470093552
EAN: 2147483647
Year: 2004
Pages: 162

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net