Anda di halaman 1dari 8

Messages passing is a relatively simple mechanism suitable for both interprocess

communication and synchronization in centralised as well as distributed environment.


When message passing is used for communication and synchronization, processes
send and receive messages instead of reading and writing shared variable.
Communication is performed because a process upon receiving a message obtains
values from some sender process. Synchronization is achieved because a message
can be received only after it has been sent, which constrains the order in which these
two events can occur.
send (message)
to destination-mode
The message contains the values of expressions in expression- list at the time send is
executed. The destination-Mode gives the program control over where the message
goes and hence over which statements can receive iL A message is received by
executing:
receive (message)
from source mode
The message is received through a list of variables. The source_Mode gives the
programmer control where the message come from and hence over which statements
could have sent it. Receipt of messages causes, first assignment of the values in the
messages to the variables in variable_list and second, subsequent destruction of the
message.
If processes P and Q want to communicate they must send and receive messages from
each other. In order to do so, a communication link must exist between them. This link
can be implemented in a variety of ways. We are not concerned here with physical
implementation of a link (such as shared memory or a hardware bus), but more in the
issues of its logical implementation, such as its logical properties. Some basic
implementation questions are:

How are links established?

Can a link be associated with more than two processes?

How many links can there be between every pair of processes?

What is the capacity of a link? That is, does the link have some buffer space? If
so, how much?

What is the size of messages? Can the link accommodate variable size or fixed
size message?

Is a link unidirectional or bi-directional? That is, if a link exists between P and Q,


can message flow in one direction (such as only from P and Q) on in both
directions?

Explain the Features of a Message Passing


System?

Message passing is the paradigm of communication where messages are s

(remote) method invocation, signals, and data packets. When designing a m


Whether messages are transferred reliably
Whether messages are guaranteed to be delivered in order

Whether messages are passed one-to-one, one-to-many (multicasting or


Whether communication is synchronous or asynchronous.

Prominent theoretical foundations of concurrent computation, such as th

Implementations of concurrent systems that use message passing can ei

series of library calls from the language. Examples of the former include m

operating systems pass messages between one kernel and one or more se
computing.
Message passing systems and models

Distributed object and remote method invocation systems like ONC RPC, C
OpenBinder, D-Bus and similar are message passing systems.

Message passing systems have been called "shared nothing" systems beca
may be used in the implementation of sending messages.

Message passing model based programming languages typically define mes


item to a communication endpoint (Actor, process, thread, socket,

etc.). Such messaging is used in Web Services by SOAP. This concept is th


than a packet and can optionally be made reliable, durable, secure, and/or

Messages are also commonly used in the same sense as a means of inte

pipes, in which data are sent as a sequence of elementary data items instea
Examples of message passing style
#Actor model implementation
#Amorphous computing
#Flow-based programming
#SOAP (protocol)
Synchronous versus asynchronous message passing

Synchronous message passing systems require the sender and receiver to


continue until the receiver has received the message.

Synchronous communication has two advantages. The first advantage is


synchronisation point between sender and receiver on message transfer.

always be stored on the receiving side, because the sender will not continue

Asynchronous message passing systems deliver a message from sender to

asynchronous communication is that the sender and receiver can overlap th

Synchronous communication can be built on top of asynchronous commun


message from the receiver before continuing.

The buffer required in asynchronous communication can cause problems w

whether to discard future messages. If the sender is blocked, it may lead t


is no longer reliable.

Explain the following in the Context of


Message Passing: A) Synchronization B)
Buffering C) Process Addressing?
(A) Synchronization

A major issue in communication is the synchronization imposed on the com


types of communicating primitives: Blocking Semantics and Non-Blocking S

Blocking Semantics: A communication primitive is said to have bloc


example in the case of send, the sender blocks until it receives an ack

Non-blocking Semantics: A communication primitive is said to have


its invoker.

The synchronization imposed on the communicating processes basically dep


primitives.
Blocking Primitives

Blocking Send Primitive: In this case, after execution of the send st


acknowledgement from the receiver that the message has been receiv

Non-Blocking Send Primitive: In this case, after execution of the se


execution as soon as the message is copied to the buffer.

Blocking Receive Primitive: In this case, after execution of the recei

Non-Blocking Receive Primitive: In this case, the receiving process

execution of receive statement, which returns the control almost imme

Handling non-blocking receives: The following are the two ways of

Polling: a test primitive is used by the receiver to check the buffe

Interrupt: When a message is filled in the buffer, software interrupt


programming difficult.
(B)Buffering

The transmission of messages from one process to another can be done by


receivers address space. In some cases, the receiving process may not be
that message for later reception. In such cases, the operating system would
can be stored prior to receiving process executing specific code to receive t

The synchronous and asynchronous modes of communication correspond to


with unbounded capacity. Two other commonly used buffering strategies ar

single-message and finite-bound, or multiple message buffers. These four t

No buffering: In this case, message remains in the senders addres

Single message buffer: A buffer to hold a single message at the rec


communication because in this case an application can have only one

Unbounded - Capacity buffer: Convenient to support asynchronous

Finite-Bound Buffer: Used for supporting asynchronous communica

Buffer overflow can be handled in one of the following ways:

Unsuccessful communication: send returns an error message to the


the receiver because the buffer is full.

Flow-controlled communication: The sender is blocked until the rec


asynchronous send. This will also result in communication deadlock.
1.An absolute pointer value has no meaning (more on this when we talk
encoding mechanisms should be adopted to pass such objects.

2. Different program objects, such as integers, long integers, short integ


encoding of these objects, the receiver should be able to identify the typ

A message data should be meaningful to the receiving process. This impl


they are being transmitted from the address space of the sending proces
heterogeneous systems in which the sending and receiving processes are
it is very difficult to achieve this goal mainly because of two reasons:

One of the following two representations may be used for the encoding a
each program object as well as its value is encoded in the message. In th
type of each program object in the message because of the self-describin
message contains only program objects, no information is included in the
receiving object should have a prior knowledge of how to decode the rec
(C) Process Addressing
A message passing system generally supports two types of addressing:

Explicit Addressing: The process with which communication is desir

e.g. send (pid, msg), receive (pid, msg).

Implicit Addressing: A process does not explicitly name a process fo


a process. e.g. send any (service id, msg), receive any (pid, msg
Methods for process addressing:

machine id@local id: UNIX uses this form of addressing (IP address

Advantages: No global coordination needed for process addressing. Disad

machine id1@local id@machine id2: machine id1 identifies the node on w


the process is created.

machine id2 identifies the last known location of the process. When a pro
which the process migrates) is left with the current machine. This inform
Disadvantages:
Overhead involved in locating a process may be large.

If the node on which the process was executing is down, it may not be

Anda mungkin juga menyukai