Summary of inter-process communication methods for Linux

Source: Internet
Author: User

① Anonymous piping (pipe)The anonymous pipe (pipe) pipe is a half-duplex method of communication, and the data can only flow in one direction. If you want to do duplex communication, you need to set up two pipelines. pipelines can only be used among affinity processes, such as parent-child processes or sibling processes. ② Famous pipe (MKFIFO) a well-known pipe is also a two-way communication, but it allows for the use of unrelated processes. ③ Signal Volume (Semophore) semaphores are commonly used as a locking mechanism, a register that controls the access of multiple processes to shared resources, and prevents multiple processes from accessing a shared resource at the same time. Semaphores are primarily used as a means of synchronization between processes or between different threads in the same process. ④ Signal (sinal) signal is a more complex way of communication, to inform the receiving process that some events have occurred, pay attention to signal processing in the function called is the signal security. ⑤ Message QueueMessage Queuing consists of a list of messages, stored in the kernel, and identified by message queue identifiers. ⑥ Shared Memory shared Memory is the mapping of memory accessed by other processes, which is created by a process that can be accessed by multiple processes. Shared memory is the fastest IPC approach and is specifically designed for low operational efficiency of other interprocess communication modes. It is often used with other communication mechanisms, such as semaphores, to achieve synchronization and communication between processes. ⑦ Socket (socket) sockets are also a way of interprocess communication, and unlike other methods, it can be used to communicate with processes between different hosts (which is also its primary purpose). disadvantages of several ways pipe: Slow, limited capacity, can only be used to communicate between kinship processes. Well -known pipeline: Same as pipeline, but allows non-affinity interprocess communication. Message Queuing: Capacity is restricted by the system, and data is left in the queue, which is read with the unread data in mind. semaphore: Mainly used for synchronization, unable to transfer complex data information.

Summary of inter-process communication methods for Linux

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.