EmbLogic's Blog

IPCs

INTER-PROCESS COMMNICATION

What is Inter-process Communication?

Inter-process communication as the name suggests is the exchange of information between two dependent /independent processes.

 

Why it is required?

There are cases when processes may need to work together;for example a process may need to compress an image that is to be performed by some other process,in that case the first process must tell the second process that it needs its services and hence send image and receive the compressed image. Thus the requirement of inter-process communication.

 

How inter-process communication is needed?

In Linux,inter-process communication is achieved using:-

->Signals

->Pipes

->FIFO’s

->Message queues

->Shared memory

->Semaphores

Signals,Shared memory and Message queues are mostly used as synchronization techniques rather than as Inter-process Communication mechanism.

 

Project Implementation:-

Aim:-To achieve inter-process communication between multiple client(requesting and processing) processes and a single server using Inter-process communication techniques.

 

Explanation:-

In this project multiple requesting clients requests a server process to get their respective results

Requesting Client 1———->S V————->Processing Client 1

Requesting Client 2———->E E————->Processing Client 2

Requesting Client 3———->R R————>Processing Client 3

 

Server is always runing in the background.

Firstly requesting client requests the server by sending the data along with the data it wants to get performed.

Next the server receives the request and it sends the same request to the processing client.

Now the processing client processes the data and should return the result to the server.

Meanwhile the procesing client is processing the request, the requesting client and the server should wait.

After the processing client sends the result to the server,the server sends the result to the requesting client.

There can be many requesting clients thus the server should be prepared for it.

 

Implementation:-

The project was implemented using Pipes,FIFOs and Pipes,Message queues, FIFOs and shared memory and FIFOs and message queues.

Challenges:-

->The major challenge during the project implementation was the synchronization between the requesting client and the server And server and processing client.

When implemented using pipes,synchronization was acheived using the signals mechanism. The requesting clients after sending the request waits for a signal from the server indicating that result is available.

At the same time the server waits for the result from processing client using signal.

In case of implementation using FIFOs and pipes,synchronization was acheived using signals.

For message queues,synchronization was acheived using the tokens only.

And semaphores were used for the other implementations of the same project.

 

->The next challenge was the encapsulating of the requests and the results into a single packet that would be exchanges between the processes. Since request consisted of many things,they were converted to a single packet of data using sprintf() function.

Same method was used for the result.

 

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>