Eight methods for process communication in Linux

Source: Internet
Author: User
There are eight methods for process communication in Linux: pipelines, named queues (FIFO), memory Ory ing (mappedmemeory), messagequeue, and sharedmemory ), semaphore, signal, Socket ). (1) MPs queue (pip...
Eight methods for process communication in Linux: pipelines, named queues (FIFO), memory Ory ing (mapped memeory), message queues ), shared memory, semaphore, signal, Socket ).
(1) pipeline (pipe): The pipeline allows one process to communicate with another process with which it has a common ancestor;
(2) named pipe (FIFO): similar to a pipe, but it can be used for communication between any two processes. the named pipe has a corresponding file name in the file system. The named pipe is created by running the mkfifo command or by calling the mkfifo command;
(3) signal: a signal is a complex communication method used to notify the receiving process that something happens, except for inter-process communication, the process can also send signals to the process itself. in addition to supporting the UNIX early signal semantic function signal, Linux also supports the signal function sigaction whose semantics complies with the POSIX.1 standard (in fact, this function is based on BSD, BSD can implement reliable signal mechanism and unified external interface, and implement the signal function again using the sigaction function );
(4) memory meming (mapped memory): memory ing allows communication between any process, every process using this mechanism maps a shared file to its own process address space;
(5) message queue: a connection table for messages, including POSIX and System V message queues. A process with sufficient permissions can add messages to the queue. a process with the read permission can read messages from the queue. The message queue overcomes the disadvantages such as the small amount of information carried by the signal, the pipe can only be the unformatted byte stream, and the limited buffer size;
(6) semaphore: semaphores are mainly used for synchronization between processes and between different threads of the same process;
(7) shared memory: it allows multiple processes to access the same memory space. it is the fastest available IPC form. This is designed for low operating efficiency 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;
(8) Socket: it is a more common inter-process communication mechanism and can be used for inter-process communication between different machines. It was initially developed by the BSD branch of the UNIX System, but now it can be transplanted to other UNIX-like systems: both Linux and System V variants support sockets;
Author: kongweile

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.