Message passing is a data transfer mechanism that is used in various forms in a number of programming languages
The basic form of data transfer in programming languages is the assignment statement. It is carried out by a (computing) agent that moves data from one part of the memory to another. The substantial difference between assignment and message passing is that message passing incorporates two active agents, a sender and a receiver. The sender has exclusive control over the source locations of the data to be transferred, while the receiver has exclusive control over the destination of the data.
Message passing can be classified by a number of criteria, the most important of which is
Mode of operation:
- Synchronous (also called rendezvous or handshaking): Sender and receiver perform their transfer operations simultaneously. They may have to wait before transfer becomes possible.
- Asynchronous: Sender is allowed to transfer data to a temporary location where it can be accessed by the receiver. Sender does not have to wait if temporary storage is available.
Addressing:
- Direct: Sender and receiver refer to each other directly, by using unique IDs.
- Indirect: There is an auxiliary object (channel) that connects the sender and the receiver, who only refer to the channel during message passing.