Message Passing: Message passing is a method of inter process communication used in parallel programming systems. It uses two function calls: send and receive for sending and receiving messages. In this method, a receiver sends acknowledgement message to the sender when a message is received. The concept of acknowledgement message is used for making sure that the messages are not lost. A mailbox is used for holding the messages.
Solution of Producer consumer problem by using message passing:
#define MAX 100
item = produce_item( );
int item, i;
for (i = 0; i < MAX; i++)
item = extract_item(&mesg);
Here, MAX is the total number of messages which can be sent.