The main communication modes of inter-process communication

Source: Internet
Author: User
Tags message queue semaphore

Inter-process communication is actually between different processes to spread or exchange information between the different processes require some mutual access to the media, the process of user space is independent of each other, generally can not access each other, the only exception is the shared memory area, on time system space of public places, So the kernel can obviously provide a condition that, for the first time, is a peripheral that can be accessed by both parties, in this sense, two processes can of course also exchange information through ordinary files on disk, which Exchange information through some table entries and records in the registry or other database. Broadly speaking, this is also a means of inter-process communication, but it is generally not counted as "interprocess communication" because the efficiency of these means of communication is too low, and the requirement for inter-process communication is to have a certain amount of real-time


Inter-process communication mainly includes pipelines, system IPC (including message queue, semaphore, shared storage), SOCKET


Pipeline consists of three kinds: (1) ordinary pipe pipes, usually have a limit, one half-duplex, only one-way transmission, two can only be used between the AX process (2) Flow pipe s_pipe, remove the first restriction, can be two-wire transmission (3) Named pipe: Name_pipe, remove the second limit, Can communicate between many unrelated processes


Pipeline: A pipe is a half-duplex communication mode, the data can only flow in one direction, and can only be used between the processes that have affinity, process affinity is usually referred to as parent-child relationship


Well-known pipeline: is a half-duplex approach, but allows communication between unrelated processes.


Semaphore: is a counter that can be used to control access to shared resources by multiple processes, often as a locking mechanism that prevents a process from accessing the shared resource while other processes are accessing it. So as a means of synchronization between processes and between different threads within the same process


Message Queuing: Message Queuing is a list of messages, stored in the kernel and identified by Message Queuing identifiers, Message Queuing overcomes the lack of signal transmission information, the pipeline can only host unformatted byte stream and buffer size is limited and other characteristics


Signal: A signal is a more sophisticated form of communication used to inform the receiving process of the memory accessed


Shared memory: Shared memory is a mapping of memory that can be accessed by other processes, which is created by a process, but multiple processes are accessible, shared memory is the fastest IPC method, is designed specifically for other interprocess communication modes, and is often used in conjunction with other communication mechanisms such as semaphores, To enable inter-process communication


Sockets: A socket interface is also an inter-process communication mechanism, unlike other communication mechanisms, which can be used in different and inter-process processes




This article is from the "Newton also eat apple" blog, please be sure to keep this source http://mi55u.blog.51cto.com/11619321/1974736

The main communication modes of inter-process 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.