问题
According to the book 'operating systems concepts', it says:
With direct communication, each process that wants to communicate must explicitly name the recipient or sender of the communication. This scheme exhibits symmetry in addressing. In this scheme, the send and receive primitives are defined as:
- Send(P, message): Send a message to process P
- receive (Q, message)-Receive a message from process Q.
In asymmetry only the sender names the recipient; the recipient is not required to name the sender. In this scheme, the send and receive primitives are defined as follows:
- Send(P, message): Send a message to process P.
- receive(id, message):Receive a message from any process; the variable id is set to the name of the process with which communication has taken place.
I can't understand what is the difference? In asymmetric scheme, doesn't the receive()
call need to specify the sender id?
回答1:
That the receive() call does not specify the sender id is the difference. The implication is that the sender:receiver relationship is many to one (N:1), whereas the symmetric case is 1:1. Many implementations offer secondary mechanisms to blur this implications.
In the N:1 case, there needs to be some explanation of the mechanisms for handling multiple simultaneous senders. Explanations involve policy:first come first served; random; priority, capacity: #-threads, and perhaps inheritance of scheduling parameters and constraints.
In the 1:1 case, there is no need for policy or capacity, and it is safe to assume inheritance is innate. Thusly, the 1:1 case is more amenable to automated analysis.
A 1:1 system that permits dynamic configuration of sender:receiver pairs can be even more complex than these identified systems. In this sort of system, a sender may discover a receiver by some process which instantiates a receiver for this sender. Uncovering the policy,capacity,inheritance attributes is more complex in this sort of arrangement.
来源:https://stackoverflow.com/questions/57340100/ipc-in-message-passing-systems-direct-communication