The mechanism of Linux interprocess communication

6 mechanisms for interprocess communication under Linux:

    1. Pipes and named pipes : Pipes can be used for communication between processes with affinity. Named pipes overcome the limitation that pipes have no names. Therefore, in addition to the functions of pipes, it also allows no Communication between affinity processes;    

    2. Signal (Signal) : Signal is a relatively complex communication method, which is used to notify the receiving process that some event has occurred. In addition to being used for inter-process communication, the process can also send signals to the process itself; in addition to supporting Unix early signal semantics In addition to the function sigal, it also supports the signal function sigaction whose semantics conform to the Posix.1 standard (in fact, this function is based on BSD. In order to realize a reliable signal mechanism, BSD can unify the external interface, and the sigaction function re-implemented the signal function);     3 .Message (Message) queue (message queue) : The message queue is a linked list of messages, including the Posix message queue system V message queue. Processes with sufficient permissions can add messages to the queue, and processes granted read permissions can read messages from the queue. The message queue overcomes the shortcomings of the signal carrying a small amount of information, the pipeline can only carry unformatted byte streams, and the buffer size is limited. 4. Shared memory : enables multiple processes to access the same memory space, which is the fastest form of IPC available. It is designed for the inefficient operation of other communication mechanisms. It is often used in conjunction with other communication mechanisms, such as semaphores, to achieve synchronization and mutual exclusion between processes.   5. Semaphore : It is mainly used as a means of synchronization between processes and between different threads of the same process.             6. Socket : A more general inter-process communication mechanism that can be used for inter-process communication between different machines. Originally developed by the BSD fork of Unix systems, it is now generally portable to other Unix-like systems: both Linux and System V variants support sockets.
   
   
   
   

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324519428&siteId=291194637