Thursday, July 30, 2009

INTERPROCESS COMMUNICATION


Direct Communication

Direct communication can be defined as speech that specifically states and directs an action. Most of us grew up hearing direct speech from our parents or teachers: "Get that homework done before you go out to play," or, from our boss today we might hear: "I need this on my desk by Friday."

When to Use Direct Communication:
Direct communication is often necessary in working environments. There are plenty of situations when a direct style is the only appropriate option. The following situations call for this form of speech.


Indirect Communication

Unlike direct communication, a indirect style of speech is not typically authoritative, rather it encourages input from the listener. By using this method, you give the other person the opportunity to speak up. An indirect style, makes them feel as if their ideas are important. This style of communication places the listener in the "one-up" position.

When to Use Indirect Communication:
Like direct communication, indirect communication can be very useful in the workplace. This method can make teams run more smoothly and create an environment of friendly respect.


Synchronization

refers to one of two distinct but related concepts: synchronization of processes, and synchronization of data. Process synchronization refers to the idea that multiple processes are to join up or handshake at a certain point, so as to reach an agreement or commit to a certain sequence of action. Data synchronization refers to the idea of keeping multiple copies of a dataset in coherence with one another, or to maintain data integrity. Process synchronization primitives are commonly used to implement data synchronization.

=>processes takes place by calls to send and receive primitives

  • Blocking send

A blocking send returns as soon as the send buffer is free for reuse, that is, as soon as the last byte of data has been sent or placed in an internal buffer.

  • Nonblocking send

A non-blocking send returns as soon as possible, that is, as soon as it has posted the send. The buffer might not be free for reuse.

  • Blocking receive

A blocking receive returns as soon as the data is ready in the receive buffer.

  • Nonblocking receive

A non-blocking receive returns as soon as possible, that is, either with a flag that the data has not arrived yet or with the data in the receive buffer.


Buffering

=>Buffering Messages reside in a temporary queue Zero capacity Bounded capacity Unbounded capacity.

Link may have some capacity that determines the number of message that can be temporarily queued in it .

  • Zero Capacity

Explicit buffering – Zero-capacity (blocking sender, receiver)

Zero capacity: (queue of length 0)

  1. No messages wait.
  2. Sender must wait until receiver receives the message — this synchronization to exchange data is called a rendezvous.
  • Bounded Capacity

– Bounded capacity: when queue is not full, message is copied into buffer (or a pointer is kept).

Bounded capacity: (queue of length)

  1. If receiver’s queue is not full, new message is put on queue,and sender can continue executing immediately.
  2. If queue is full, sender must block until space is available in the queue.
  • Unbounded Capacity

Unbounded capacity: (infinite queue)

  1. Sender can always continue


Producer-Consumer Example

  • Procedure

A producer which generates data items and puts them in a buffer e.g. from a file

  • Consumer

A consumer which removes items from the buffer e.g. to a printer.

No comments: