MessagePassing

76

By micajeudy

Introduction: Message Passing

As we know that " process" is a program in execution. When  two computers of a distributed system are communicating with each other, we mean that two processes, one running on each computer, are in communication with each other. A distributed operating system needs to provide interprocess communication (IPC) mechanisms to facilitate such communication activities. A message passing system is a subsystem of the distributed operating system which shields the details of complex network protocols from the programmer. It enables processes to communicate by exchanging messages and allows programs to be written by using simple communication primitives such as send and receive. Inter process communication basically requires information sharing among two or more processes. The two basic methods for information sharing are as follows:

Original Sharing or Shared Data approach

  • Message is placed in a common memory area that is accessible to all processes.
  •  This is not possible in a distributed system, unless it is a distributed shared memory system (DSM).

Copy Sharing or Message Passing approach

  • Message is physically copied from sender’s address space to the receiver’s address space.
  • This is the basic IPC mechanism in distributed systems.

Note that :

  • In the shared data approach, the information to be shared is placed in a common memory area that is accessible to all the processes involved in an IPC.
  • In the method of message passing, the information to be shared is physically copied from the sender process’s address space to the address space of all the receiver processes, and this is done by transmitting the data to be copied in the form of messages.In this case the communicating processes interact directly with each other.

message passing paradigm
message passing paradigm

IPC by Message Passing

A message is a meaningful formatted block of information sent by the sender process to the receiver process. The message block consists of a fixed length header followed by a variable size collection of typed data objects. The header block of a message may have the following elements:

  1. Address: A set of characters that uniquely identify both the sender and receiver.
  2. Sequence Number: It is the Message Identifier to identify duplicate and lost messages in case of system failures.
  3. Structural Information: It has two parts. The type part that specifies whether the data to be sent to the receiver is included within the message or the message only contains a pointer to the data. The second part specifies length of the variable-size message.

The following are some important issues to be considered for the design of an IPC protocol based message passing system:

  • The Sender’s Identity
  • The Receiver’s Identity
  • Number of Receivers
  • Guaranteed acceptance of sent messages by the receiver
  • Acknowledgment by the sender
  • Handling system crashes or link failures
  • Handling of buffers
  • Order of delivery of messages


Synchronization

A major issue in communication is the synchronization imposed on the communicating processes by the communication primitives. There are two types of communicating primitives:

  • Blocking Semantics
  •  Non-Blocking Semantics.

Blocking Semantics: A communication primitive is said to have blocking semantics if its invocation blocks the execution of its invoker (for example in the case of send, the sender blocks until it receives an acknowledgement from the receiver.)

Non-blocking Semantics: A communication primitive is said to have non-blocking semantics if its invocation does not block the execution of its invoker.

The synchronization imposed on the communicating processes basically depends on one of the two types of semantics used for the send and receive primitives.

Synchronous Vs Asynchronous Communication

When both send and receive primitives of a communication between two processes use blocking semantics, the communication is said to be synchronous. If one or both of the primitives is non-blocking, then the communication is said to be asynchronous. Synchronous communication is easy to implement. It contributes to the reliable delivery of messages. Asynchronous communication limits concurrency and is prone to communication deadlocks.

Comments

munirahmadmughal profile image

munirahmadmughal 17 months ago

"Message Passing"

This is an interesting and educative hub.

The author of the hub says:"As we know that " process" is a program in execution. When two computers of a distributed system are communicating with each other, we mean that two processes, one running on each computer, are in communication with each other. A distributed operating system needs to provide interprocess communication (IPC) mechanisms to facilitate such communication activities. A message passing system is a subsystem of the distributed operating system which shields the details of complex network protocols from the programmer. It enables processes to communicate by exchanging messages and allows programs to be written by using simple communication primitives such as send and receive. Inter process communication basically requires information sharing among two or more processes. The two basic methods for information sharing are as follows:

Original Sharing or Shared Data approach

•Message is placed in a common memory area that is accessible to all processes.

• This is not possible in a distributed system, unless it is a distributed shared memory system (DSM).

Copy Sharing or Message Passing approach

•Message is physically copied from sender’s address space to the receiver’s address space.

•This is the basic IPC mechanism in distributed systems.

Note that :

•In the shared data approach, the information to be shared is placed in a common memory area that is accessible to all the processes involved in an IPC.

•In the method of message passing, the information to be shared is physically copied from the sender process’s address space to the address space of all the receiver processes, and this is done by transmitting the data to be copied in the form of messages.In this case the communicating processes interact directly with each other.

message passing paradigm IPC by Message Passing

A message is a meaningful formatted block of information sent by the sender process to the receiver process. The message block consists of a fixed length header followed by a variable size collection of typed data objects. The header block of a message may have the following elements:

1.Address: A set of characters that uniquely identify both the sender and receiver.

2.Sequence Number: It is the Message Identifier to identify duplicate and lost messages in case of system failures.

3.Structural Information: It has two parts. The type part that specifies whether the data to be sent to the receiver is included within the message or the message only contains a pointer to the data. The second part specifies length of the variable-size message.

The following are some important issues to be considered for the design of an IPC protocol based message passing system:

•The Sender’s Identity

•The Receiver’s Identity

•Number of Receivers

•Guaranteed acceptance of sent messages by the receiver

•Acknowledgment by the sender

•Handling system crashes or link failures

•Handling of buffers

•Order of delivery of messages

Synchronization

A major issue in communication is the synchronization imposed on the communicating processes by the communication primitives. There are two types of communicating primitives:

•Blocking Semantics

• Non-Blocking Semantics.

Blocking Semantics: A communication primitive is said to have blocking semantics if its invocation blocks the execution of its invoker (for example in the case of send, the sender blocks until it receives an acknowledgement from the receiver.)

Non-blocking Semantics: A communication primitive is said to have non-blocking semantics if its invocation does not block the execution of its invoker.

The synchronization imposed on the communicating processes basically depends on one of the two types of semantics used for the send and receive primitives.

Synchronous Vs Asynchronous Communication

When both send and receive primitives of a communication between two processes use blocking semantics, the communication is said to be synchronous. If one or both of the primitives is non-blocking, then the communication is said to be asynchronous. Synchronous communication is easy to implement. It contributes to the reliable delivery of messages. Asynchronous communication limits concurrency and is prone to communication deadlocks."

The author has explained various stages in learning the Message passing process.

The food for thought in this hub is that how potentialized is the mind set of humanbeings that they are using and utilizing the information technology as they intend to harness it. Praise is for God Almighty who created man and also all that a man needs. Needs are

many and multiple and the provision from the side of God Almighty is also many and multiple. The thing more strange is that man exploresa and exploits by the intelligence given to him by the Creator.

May God bless all.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    • No HTML is allowed in comments, but URLs will be hyperlinked
    • Comments are not for promoting your Hubs or other sites

    Please wait working