ProcessesIndependent – if it cannot affect or be
affected by the other processes executing in the system.Any process that does not share data with any
other process.Cooperating - if it can affect or be
affected by the other processes executing in the system.Process that shares data with other processes.
Why co-operating processes?1. Information sharing2. Computational speedup3. Modularity4. Convenience
Inter-process communication1. Shared memory – co-operating processes
share a region of memory.2. Message passing – communication takes
place by means of messages exchanged between the cooperating processes.
DifferenceShared memory Message passing
1. Processes exchange information by reading or writing into the shared region.
2. Used for exchanging large amount of data
3. Faster than message passing (system calls required only to establish shared region and rest all access are treated as normal memory access)
1. Direct exchange of messages.
2. Used for exchanging small amounts of data.
3. Slower than shared memory because it is implemented using system calls , which involves kernel intervention.
Message passingOperations
Send(message)Receive(message)
Methods to implement link b/w two processesDirect or indirect communicationSynchronous or asynchronous communicationBuffering
Direct communicationEach process must explicitly name the recipient
or sender of communication.send(P, message) – send a message to process Preceive(Q, message) – receive a message from
process QCommunication link has the following properties
Link is automatically established. Process must only know the identity of other process.
Link is associated with exactly two processesB/w each pair of processes, exists exactly one link
Indirect communicationMessages are sent and received through mailboxes or
ports.Send(A, message) – send a message to mailbox AReceive (A, message) – receive a message from
mailbox ALink properties
Link is established between a pair of processes only if both members of the pair have a shared mailbox
Link may be associated with more than two processesBetween each pair of communicating processes, there
may be a number of different links, with each link corresponding to one mailbox.
Synchronization Message passing may be blocking (synchronous)
or non blocking (non-synchronous)Blocking send – the sending process is blocked
until the message is received by the receiving process or mailbox.
Non blocking send – the sending process sends the message and resumes operation
Blocking receive – the receiver blocks until a message is available.
Non blocking receive – the receiver retrieves either a valid message or NULL.
Buffering Messages exchanged by communicating
process reside in temporary queue.These queues are implemented in three ways:
Zero capacityBounded capacityUnbounded capacity
Top Related