Subscribe to our RSS Feeds

Inter-Process Communication

3 Comments »

Inter-Process Communication

A mechanism through which data is shared among the process in the system is referred to as Inter-process communication. Multiple processes communicate with each other to share data and resources. A set of functions is required for the communication of process with each other. In multiprogramming systems, some common storage is used where process can share data. The shared storage may be the main memory or it may be a shared file. Files are the most commonly used mechanism for data sharing between processes. One process can write in the file while another process cam read the data for the same file.
Various techniques can be used to implement the Inter-Process Communication. There are two fundamental models of Inter-Process communication that are commonly used, these are:
1. Shared Memory Model
2. Message Passing Model
·        Shared Memory Model
In shared memory model. The co operating process shares a region of memory for sharing of information. Some operating systems use the supervisor call to create a share memory space. Similarly, Some operating system use file system to create RAM disk, which is a virtual disk created in the RAM. The shared files are stored in RAM disk to share the information between processes. The shared files in RAM disk are actually stored in the memory. The Process can share information by writing and reading data to the shared memory location or RAM disk.
·        Message Passing Model
In this model, data is shared between process by passing and receiving messages between co-operating process. Message passing mechanism is easier to implement than shared memory but it is useful for exchanging smaller amount of data. In message passing mechanism data is exchange between processes through kernel of operating system using system calls. Message passing mechanism is particularly useful in a distributed environment where the communicating processes may reside on different components connected by the network. For example, A data program used on the internet could be designed so that chat participants communicate with each other by exchanging messages. It must be noted that passing message technique is slower than shared memory technique.
  • A message contains the following information:
  • Header of message that identifies the sending and receiving processes
  • Block of data
  • Pointer to block of data
  • Some control information about the process
Typically Inter-Process Communication is based on the ports associated with process. A port represent a queue of processes. Ports are controlled and managed by the kernel. The processes communicate with each other through kernel.
In message passing mechanism, two operations are performed. Theses are sending message and receiving message. The function send() and receive() are used to implement these operations. Supposed P1 and P2 want to communicate with each other. A communication link must be created between them to send and receive messages. The communication link can be created using different ways. The most important methods are:
  1. Direct model
  2. Indirect model
  3. Buffering   
7:46 PM

3 Responses to "Inter-Process Communication"

Online practice tests Says :
March 14, 2011 at 4:22 PM

Please give some more detail about massage passing model.

Russell Davison Says :
March 15, 2011 at 12:27 PM

I'm curious about your point that one process can write in the file while another process can read the data for the same file. How does the operating system know which process takes precedence in the event of a data conflict.

Asif Says :
March 15, 2011 at 9:17 PM

@Russell
Operating system always give the preference to the Write function because if it does not release the resource the system move on an safe state(deadlock)

Post a Comment