What is message passing technique in OS?

Message Passing provides a mechanism to allow processes to communicate and to synchronize their actions without sharing the same address space.

For example − chat programs on World Wide Web.

Now let us discuss the message passing step by step.

Step 1 − Message passing provides two operations which are as follows −

  • Send message

  • Receive message

Messages sent by a process can be either fixed or variable size.

Step 2 − For fixed size messages the system level implementation is straight forward. It makes the task of programming more difficult.

Step 3 − The variable sized messages require a more system level implementation but the programming task becomes simpler.

Step 4 − If process P1 and P2 want to communicate they need to send a message to and receive a message from each other that means here a communication link exists between them.

Step 5 − Methods for logically implementing a link and the send() and receive() operations.

Given below is the structure of message passing technique −


The characteristics of Message passing model are as follows −

  • Mainly the message passing is used for communication.

  • It is used in distributed environments where the communicating processes are present on remote machines which are connected with the help of a network.

  • Here no code is required because the message passing facility provides a mechanism for communication and synchronization of actions that are performed by the communicating processes.

  • Message passing is a time consuming process because it is implemented through kernel (system calls).

  • It is useful for sharing small amounts of data so that conflicts need not occur.

  • In message passing the communication is slower when compared to shared memory technique.