Linux interprocess communication (i) Overview of interprocess communication and its categories

Source: Internet
Author: User
Tags semaphore socket

Why is there interprocess communication?

We should all know that the process is a program execution, is the system resource allocation of the smallest unit. The process described here generally refers to the process running in the user state, and because the different processes in the user state are isolated from each other, they are likely to need to send some information to each other so that they know their progress and so on, such as the process of passing information between processes is called interprocess communication.

How many ways are there to communicate between processes?

Like the communication between people in different cities there are mobile phones, computers and other means, the process of communication between the several ways, using the following diagram to express, so intuitive, and I have always believed that this time a knowledge point, must write down!

Pipelines (Pipe) and known pipes (Named Pipe): Pipelines can be used for communication between "blood" relationship processes (i.e., parent-child processes or sibling processes). In addition to the functionality that a pipe has, a well-known pipe allows communication between processes without a "blood" relationship.

Signal (Signal): A signal is a software-level simulation of the interrupt mechanism, it is a more complex way of communication, used to inform the process of an event occurred. Should have learned arm or SCM interruption, in fact, a process received a signal and the processor received an interrupt request effect can be said to be the same (attention is the effect of Oh!). )。

Semaphore (semaphore): a means of synchronization and mutual exclusion primarily between processes and between different threads of the same process. Fierce look, may be confused with the signal, but they are at least English is different, I was also not clear he two, but it does not matter, do not understand synchronization and mutual exclusion is OK, later will be detailed, first know that there is this thing on the line.

Shared memory Memory: This is the most efficient way to communicate between processes. It allows multiple processes to access the same memory space, and different processes can see updates of the data in the shared memory in the process in a timely manner. This type of communication relies on some sort of synchronization mechanism, such as mutual locks and semaphores.

Message Queuing (Messge queue): Message Queuing is a list of messages, including Posix message queues and System V message queues. It overcomes the shortcomings of limited information in the first two modes of communication, the process with write permissions can add messages to message queues according to certain rules, and processes that have read permissions on message queues can read messages from message queues.

Socket (SOCKET): This is definitely a more general interprocess communication mechanism, it can be used in the network between different machines in the process of communication, application that is quite extensive ah.

I do not want to write more, I feel the process of communication between Linux, the first macroscopic understanding of it on the line, first know these two problems, and then one by one break it!

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.