Communication inter-process

In Data-processing, the communications inter process ( Inter-Process Communication or IPC) gather a whole of mechanisms making it possible processes competitor (or distant) to communicate. These mechanisms can be classified in three categories:

  • tools allowing the processes to exchange data;

  • tools allowing to synchronize the processes, in particular to manage the critical Sections;
  • tools directly offering the characteristics of two first (IE: allowing to exchange data and to synchronize processes).

Exchange of information

The file S can be used to exchange information between two, or several processes. In this case, processes wanting to send information write in one (or several) file (S) with a certain position; the processes wishing to receive this information position with “good” site in a file and read them. This type of exchange is possible between competitor processes, while using the local filesystem, or distant by using a filesystem distributed such as NFS.

The memory (principal) of a system can also be used for exchanges of information. According to the type of process, the tools used are not the same ones.

  • In the case of the “traditional” processes, the memory capacity of the process is not divided. One uses mechanisms of shared memory then, like the segments of memory shared for Unix.
  • Danslecasde the light processes the memory capacity is divided, the memory can thus be used directly.
In both cases, the exchanges are carried out while placing the data in variables shared by the processes.

Whatever the method used to share the data, this type of communication poses the problem of the critical sections: moment where the processes reach the shared data. Indeed if two processes reach “at the same time” one resource, the data are likely not to be coherent more; of more this type of conflict generally results in one “planting” of one or all the processes concerned.

Synchronization

See also: Synchronization (multitasks)

The mechanisms of synchronization are used to solve the critical problems of sections and more generally to block and resolve processes according to certain conditions.

The Verrous make it possible to block all or part of a file. These blockings can be realized either for the operations of reading, either of writing, or for both.

The semaphore S are a more general mechanism, they are not associated a particular type of resource and allow to limit the competitor access with a section criticizes with a certain number of processes. With this intention them semaphores use two functions: P and V, and a meter. The function P décremente the meter, if the meter is negative it process is blocked. The function V increments the meter and frees one of the blocked process.

The signals in the beginning are intended to kill (to finish) one process under certain conditions, for example signal SIGSEGV kill a process which carries out an access to a storage area that it did not allocate. The signals can however be diverted towards other functions. The blocking of a process is done then in asking waiting of the arrival of a signal and the releasing consist in sending a message to the process.

The problem of the mechanisms of synchronization is that the processes are blocked that if they use them. Moreover, their use is difficult and involves problems of deadlock (all the processes are blocked).

Exchange of information and synchronization

These tools gather the possibilities of both others and are simpler of use.

The idea of this type of tool is to communicate by using the principle files, the processes wanting to send information place them in the file; those wanting to receive them recover them in this even file. The operations of writing and reading in the file are blocking and thus allow synchronization.

This principle is used by the queues of message (message tail) under Unix, by the sockets Unix or Internet, by the tube S, named or not, and by the transmission of messages (Passing Message).

Random links:P.D.Q. Bach | Robert Burdet | Jean III of Oświęcim | Béji Caïd Essebsi | Eric Balled | 130s_AVANT_JÉSUS_CHRIST