Message Passing System:-
The function of a message passing system is to allow processes to communicate with one another without the need to resort to shared data. We have already seen message passing used as a method of communication in microkernels. In this scheme, services are provided as ordinary user processes. That is, the services operate outside of the kernel. Communication among the user processes is accomplished through the passing of messages. An IPC facility provides at least the two operations: send (message) and receive (message).
Messages sent by a process can be of either fixed or variable size. If only fixed-sized messages can be sent, the system-level implementation is straightforward. This restriction, however, makes the task of programming more difficult. On the other hand, variable-sized messages require a more complex system-level implementation, but the programming task becomes simpler.
If processes P and Q want to communicate, they must send messages to and receive messages from each other; a communication link must exist between them. This link can be implemented in a variety of ways. We are concerned here not with the link’s physical implementation, but rather with its logical implementation. Here are several methods for logically implementing a link and the send/receive operations:
- Direct or indirect communication
- Symmetric or asymmetric communication
- Automatic or explicit buffering
- Send by a copy or send by reference
- Fixed-sized or variable-sized messages
We look at each of these types of message systems next.
Communication between processes takes place through calls to send and receive primitives. There are different design options for implementing each primitive. Message passing may be either blocking or nonblocking-also known as synchronous and asynchronous.
The sending process is blocked until the message is received by the receiving processor by the mailbox.
The sending process sends the message and resumes operation.
The receiver blocks until a message is available.
The receiver retrieves either a valid message or a null.
Different combinations of send and receive are possible. When both the send and receive are blocking, we have a rendezvous between the sender and the receiver.
Whether the communication is direct or indirect, messages exchanged by communicating processes reside in a temporary queue. Basically, such a queue can be implemented in three ways:
The queue has a maximum length 0; thus, the link cannot have any messages waiting in it. In this case, the sender must block until the recipient receives the message.
The queue has finite length n; thus, at most n messages can reside in it. If the queue is not full when a new message is sent, the latter is placed in the queue (either the message is copied or a pointer to the message is kept), and the sender can continue execution without waiting. The link has a finite capacity, however. If the link is full, the sender must block until space is available in the queue.
The queue has potentially infinite length; thus, any number of messages can wait in it. The sender never blocks. The zero-capacity case is sometimes referred to as a message system with no buffering; the other cases are referred to as automatic buffering.