INTERPROCESS COMMUNICATION BUFFERING STRATEGY

4 min


INTERPROCESS COMMUNICATion

For one or more of these reasons, people have been building systems of multiple cooperating processes for some time now, and the number of such systems is growing rapidly, both in absolute numbers and as a percentage of new applications. Obviously, if we are going to have a system that is comprised of multiple processes, those processes will have to communicate to get the work done. However, interprocess communication we have spent a great deal of time and effort making sure that two processes running on the same system can’t interfere with one another.

Therefore, we need to develop mechanisms to allow processes to communicate. As developers began to recognize this need, those of them in different environments saw the problem in different terms. They also had different tools to work with. IBM mainframe customers using SNA and SDLC saw things differently from PC users using Novell Netware, and they saw things differently from UNIX or VAX users with XNS or DECNet or TCP/IP. As a result, there are dozens of different mechanisms that exist for processes to communicate with one another. There are two fairly different types of mechanisms for IPC. On the one hand, interprocess communication there are message-passing mechanisms. They operate much as the term specifies one process sends a message to another process using some facility of the OS. Message passing is generally done between processes.

On the other hand, is the use of shared memory. With such a mechanism two or more tasks share access to one block of memory. Sharing of memory space is implicit between threads of a single process, but it can also be done among processes. Before discussing these classes of mechanisms we will first abstract the common features of all the mechanisms so that when you are faced with a different machine you will have an organized structure with which to identify the important characteristics. Then we look at a few of the more common mechanisms.

Attributes of communication mechanisms

The services available for processes to use for communication can be characterized by several different attributes:

  • Number of processes that can use a single channel at one time
  • One-way or bidirectional connections
  • Buffering strategy (none, 1, N, infinite)
  • Connection-oriented or connectionless
  • Naming strategy (name, one way or two way, mailbox, port)
  • Multicast, broadcast, unicast
  • Multiple or single connections possible
  • Streaming or message-oriented
  • Heterogeneous or homogeneous only
  • Synchronous or asynchronous
  • Persistent or transient

Number of processes supported.

In most cases, there are only two processes involved in specific interprocess communication. But in some cases, there can be many processes involved in communicating among themselves at the same time. For example, many processes might be able to simultaneously share a connection to a single process that would write records to a log file.

One-way or bidirectional:-

While it might be somewhat unusual for cooperating processes to have communication that was only one way, it is not unusual to have communication channels that are one way. What normally happens with one-way channels is that two channels may be set up between two processes, but the channels are going in opposite directions. This type of mechanism is usually found where the communication is much heavier in one direction than in the other. For example, interprocess communication one process is sending transactions to a second process and the second process is only sending back acknowledgements. We might need many large buffers on the first channel but many fewer or much smaller buffers or lower bandwidth on the return channel.

Buffering strategy:-

There are four different cases of handling the buffers in a communication channel based on the number of buffers available: none, one, N, and infinite. The first case is where there is no buffer to which both processes have access. Both processes must be accessing the channel at the same time so that one process can send the message to the other process. The second case is that there is only one buffer with both processes having shared access to it. In this case, the sending process will put a message in the buffer and then tell the OS it is available. The OS will tell the receiving process that the message is there and it will take the message out of the buffer. It will then tell the OS that the sender can send another.

The case of one buffer might appear to be just one possible instance of the case of N buffers, but in the case of one buffer, we can use simple mechanisms to synchronize the processes. interprocess communication The processes always know which buffer to use, and the processes only need to coordinate whether the buffer is now available for the sender to insert a message into it or not. In the case of N buffers, we have much more information to coordinate. The communication channel mechanism for each process must know where the buffers are and which ones contain messages and which do not. We discuss these problems further in Section

The last case is where the channel mechanism has some external memory that it can use to expand the buffer space by essentially an infinite amount. An example might be a spooling system that uses a disk file to hold a message stream until a printer is available on which to print it. For practical purposes, the sending process can consider the buffer to be infinite.

Connection oriented or connectionless:-

A communication channel can be connection-oriented or connectionless. Sometimes communicating processes need to establish a complex conversation. In this case, they will be likely to establish a connection that they will use for the duration of their interaction. A good analogy is a telephone call where one person calls another. The terminology comes from a time when connections were made between devices using an actual physical connection. Today the connection is likely to be a logical or virtual connection.

Sometimes, however, one process simply has information to send and does not care what other processes might be listening. An example might be an application where a server in a company is broadcasting stock purchase information so that clients can receive it if they want. An analogy might be to a radio broadcast. There might be millions of listeners or none

Also Read:-


Like it? Share with your friends!

5 Comments

Your email address will not be published. Required fields are marked *

error: Content is protected !!