Addressing (OS)

How are processes addressed?

Clearly, it is necessary to have a way of specifying in the send primitive which process is to receive the message. Similarly, most implementations allow a receiving process to indicate the source of a message to be received.

The various schemes for specifying processes in send and receive primitives fall into two categories:

  1. direct addressing
  2. indirect addressing

Direct Addressing

With direct addressing, the send primitive includes a specific identifier of the destination process. The receive primitive can be handled in one of two ways. One possibility is to require that the process explicitly designate a sending process. Thus, the process must know ahead of time from which process a message is expected. This will often be effective for cooperating concurrent processes. In other cases, however, it is impossible to specify the anticipated source process. An example is a printer-server process, which will accept a print request message from any other process. For such applications, a more effective approach is the use of implicit addressing. In this case, the source parameter of the receive primitive possesses a value returned when the receive operation has been performed.

Indirect Addressing

In contrast to direct addressing where messages are sent directly from sender to receiver, for indirect addressing, messages are sent to a shared data structure consisting of queues (called mailboxes) that can temporarily hold messages.

Thus, for two processes to communicate, one process sends a message to the appropriate mailbox, and the other process picks up the message from the mailbox.