Why the Linux process communicates and the main means of communication

Source: Internet
Author: User
Tags message queue posix

Why do processes need to communicate?

1. Data sharing: One process needs to send its data to another process.

2, resource sharing: Multiple processes share the same resources.

3. Notification event: A process needs to send a message to another or a set of processes to notify them that an event has occurred.

4. Process Control: Some processes want full control over the execution of another process, at which point the control process wants to be able to intercept all operations of another process and be able to know its state changes in a timely manner.

The Linux process Communication (IPC) is developed from the following parts:

1. UNIX Inter-process communication

2. Inter-process communication based on SYSTEMV

3. POSIX interprocess communication

Several main means of interprocess communication under Linux:

1. Pipelines and Named pipes: pipelines can be used for communication between affinity processes, and named pipes overcome the limitations of pipes without names, so that, in addition to having the functionality of a pipeline, it allows communication between unrelated processes.

2, signal: Signal is a more complex means of communication, used to inform the receiving process that an event occurred in addition to the process of communication, the process can also send signals to the process itself; Linux in addition to supporting early UNIX signal semantic function signal outside, also supports the sigaction of signal functions that are semantically compliant with the POSIX.1 standard.

3. Message Queuing: A messaging queue is a connection table for messages, including POSIX Message Queuing SYSTEMV Message Queuing. A process with sufficient permissions can add messages to the queue, and a process that is given Read permission can read the messages in the queue. Message queue overcomes the disadvantage that the signal carrying information is low, the pipeline can only carry the unformatted byte stream and the buffer size is limited.

4, Shared memory: Allows multiple processes to access the same piece of memory space, is the fastest available IPC form. Designed for low-efficiency 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, the signal volume: mainly as between the process and the same process between different threads synchronization means.

6, Socket interface: More general inter-process communication mechanism, can be used for inter-process communication between different machines. Originally developed by the BSD branch of the UNIX system, it is now generally portable to other Unix-like systems: both Linux and System V variants support sockets.


This article is from the "end-of-the-guest" blog, please be sure to keep this source http://zheng2048.blog.51cto.com/10612048/1826545

Why the Linux process communicates and the main means of communication

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.