Message Passing In Java

  • When a thread sends a message (an object) to another thread.
  • Used for thread communication and synchronization in environments where the threads do not have shared memory Hence the threads cannot share semaphores or monitors and cannot use shared variables to communicate. Message passing can still be used, of course, in a shared memory platform.
  • Messages are sent through a channel with an operation like send(channel, message) and received from a channel with an operation like receive(channel, message). Messages can be passed synchronously, meaning the sender blocks until the received does a receive and the receiver blocks until the sender does a send. Since the sender and receiver are at specific known points in their code at a known specific instant of time, synchronous message passing is also called a simple rendezvous with a one-way flow of information from the sender to the receiver. An example is a chess game agent. The agents can process messages synchronously, since they'll be handshaking throughout the entire game.
  • In asynchronous message passing, the sender does not block. If there is not a receiver waiting to receive the message, the message is queued or buffered. The receiver still blocks if there is no queued or buffered message when a receive is executed.

Any Comments about this page

Your name
Extra comments
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.