What is indirect communication?
Indirect communication is defined as communication between entities through intermediaries in a distributed system, without coupling between sender and receiver.
Indirect communication has two characteristics:
(1) Spatial decoupling: the sender does not need to know who the receiver is.
(2) Time decoupling: the sender and receiver can have independent lifecycles.
The paradigm of indirect communication
1. sets of communication
Group communication realizes multicast communication. Through one operation, messages are sent to all members of the group to communicate with all members of the system. An important feature of group communication is that a process item initiates a multicast operation, rather than multiple send operations to each process.
a. Closed and open groups
Closed group: for closed group members, only group members can multicast to it.
Development Group: for members of an open group, members outside the group can also multicast to it.
b. Overlapping and non overlapping groups
Overlapping groups: entities (objects or processes) can be members of multiple groups.
Non overlapping groups: entities (objects or processes) can belong to at most one group.
2. Publish subscribe system
In the publish subscribe system, the publisher publishes events to the event service, and the subscriber expresses interest in specific events through subscription. The task of publish – subscribe system is to match the event of subscription and publish, and ensure the correct delivery of event notification. A given event is passed to multiple subscribers, so the publish subscribe system is a one to many communication paradigm.
(2) Subscription model
a. Channel based
Publishers publish events to named channels, subscribers subscribe to one of the named channels, and receive all events sent to that channel.
b. Subject based
Each event notification can define multiple topics, and subscribers can subscribe according to the topics they are interested in.
c. Content based
Content based subscription is a generalization of topic based subscription.
d. Based on type
In an object-based method, an object has a specified type. In a type based approach, subscriptions are defined according to event types and given event types or subtypes.
(3) Architecture of publish subscribe system
The producer process sends messages to a specific queue, and the consumer process receives messages from the queue. There are three receiving methods:
a. Blocking reception: keep blocking until a suitable message is available.
b. Non blocking reception (polling): checks the flags of the queue, returns a message that is available, or an indication that it is not available.
c. Notification action: when a message is available in the queue, an event notification is sent to the consumer.
(2) JMS (Java Message Service)
4. Distributed shared memory
Distributed shared memory (DSM) is an abstraction used to share data with physical machines that do not share memory. Distributed shared memory enables processes of different computers to access data of different processes just as they access data of their own processes.
(2) Comparison with messaging
|Comparative content||Distributed shared memory||message passing|
|serialize||Variables are shared directly by related processes and do not need to be serialized.||Variables are serialized in the sending process and deserialized in the receiving process.|
|Safety||The process sharing distributed memory may change the data incorrectly and cause other processes to fail.||Processes that support messaging are protected because they have their own private address space.|
|Persistence||Processes that communicate through DSM can take place in a non overlapping lifecycle.||Processes that pass through messaging need to deliver messages at the same time.|
|synchronization||Implemented by common components of shared memory programming, such as locks and semaphores.||Synchronization between processes through message primitives.|
Apollo domain file system, etc.
5. Tuple space
Processes communicate indirectly by placing tuples in tuple space, and other processes can read or delete tuples from tuple space. A tuple consists of one or more data fields of type.
JavaSpaces and so on.
Summary of indirect communication style
|Comparative content||group||Publish subscribe system||Message queue||Distributed shared memory||Space group communication|
|Service style||Communication based||Communication based||Communication based||State based||State based|
|Communication mode||One to many||One to many||One-on-one||One to many||One to one or one to many|
|Main purpose||Reliable distributed computing||Information distribution or EAI; mobile and ubiquitous systems||Information distribution or EAI; business transactions||Parallel and distributed computing||Parallel and distributed computing; mobile and ubiquitous systems|
|Relevance||nothing||Content based publish subscribe||nothing||nothing||Yes|
Distributed system concept and design