"Copyright Notice: respect for the original, reproduced please retain the source: blog.csdn.net/shallnet or .../gentleliu, the article is for learning communication only, do not use for commercial purposes"This series has largely been introduced to all the commonly used IPC on Linux, and most of the IPC on Linux is inherited from UNIX. The original UNIX IPC includes: pipeline, FIFO, signal. System V IPC includes: System V Message Queuing, System V Semaphore, System V shared memory area. Due to the diversity of UNIX versions, the Institute of Electrical and Electronic Engineering (IEEE) has developed a standalone UNIX standard, a new ANSI UNIX standard called the Portable Operating System interface (Psoix) for the computer environment. Most of the existing UNIX and popular versions follow the POSIX standard, and Linux adheres to the POSIX standard from the start. POSIX IPC includes: POSIX Message Queuing, POSIX semaphore, POSIX shared memory area. So there are four main types of IPC supported on Linux:1. Unix Early IPC: pipeline, FIFO, signal; 2. System V IPC:System V Message Queuing, System V Semaphore, System v shared memory area; 3. POSIX IPC: POSIX Message Queuing, POSIX semaphore, POSIX shared memory area; 4. Socket-based IPC;
Our series does not tell the beacon related content, because the semaphore is between the process and the same process between the different threads of a synchronous way, we focus on the process of focusing on the interaction between the information between processes, and synchronous and mutually exclusive content in another series, so that more convenient to refine the knowledge classification, Conquer In fact, synchronization and mutex is a very important part of interprocess communication, so we will explain the contents of synchronization and mutex in detail immediately in the next series. The following is an analysis of the various IPC features of our series of articles:
1. SocketA, the use of the socket communication method is simple, can use the Internet domain and UNIX domain to achieve, using the Internet domain can realize the communication between different hosts. b, the mode itself carries the synchronization mechanism, does not need an additional way to assist the implementation of synchronization. C, with the process continued.
2. Shared MemoryA, the fastest way of communication, multiple processes can access the same memory space at the same time, in contrast to other ways with less data copy, high efficiency. b, need to combine signal lights or other means toImplementmultipleinter-process synchronization, itself does not have synchronization mechanism. C, with the core continued, compared with the process continued to be more powerful. 3. PipingA, an earlier form of communication, the shortcomings are obvious: only for the relationship between the process of communication;only one-way traffic is supported, and if two-way communication is required to create more than one pipeline to implement. B, self-synchronization mechanism. C, with the process continued.4. FIFOA, is a well-known pipeline, so support non-affinity process communication. Similar to shared memory, provides a path name that associates the unrelated processes together. But you also need to create two descriptors for two-way communication. B, self-synchronization mechanism.C, with the process continued.
5. SignalA, this kind of communication can carry very little information. Not suitable for communications that require frequent data portability. b, there is no synchronization mechanism, similar to the interruption, when the signal is generated, the process is not known.6. Message QueuingA, similar to shared memory and FIFO, uses a pathname to communicate between the various unrelated processes. Message Queuing has many advantages over other ways: it provides a formatted stream of bytes, which reduces the workload of the developer; The message has a type (System V) or priority (POSIX). No other way has these advantages. B, with synchronization mechanism. C, continue with the kernel.
This series is over, the time is hasty, do the programmer's hard time is so limited, analysis is not particularly deep, shallow, but also inevitably some mistakes. Expect the next sync and mutex series ...
The Linux IPC (11): A comparison of various IPC forms (end)