Ways to communicate between processes

Source: Internet
Author: User
Tags message queue semaphore

Process communication has some of the following purposes:
A, data transfer: A process needs to send its data to another process, the amount of data sent between a byte to a few m bytes
B, shared data: Multiple processes want to manipulate shared data, a process changes the shared data, and other processes should be seen immediately.
C, notification event: A process needs to send a message to another or a set of processes to notify it (they) that an event has occurred (such as notifying the parent process when the process terminates).
D, resource sharing: Multiple processes share the same resources. In order to do this, the kernel is required to provide a lock and synchronization mechanism.
E, Process Control: Some processes want to fully control the execution of another process (such as the debug process), at which point the control process wants to be able to intercept all the sink and exception of another process and be able to know its state change in time.

    • Nameless Pipe: A pipe is a half-duplex mode of communication in which data can only flow in one direction and can only be used between processes that have affinity. A process's affinity usually refers to a parent-child process relationship.
    • Advanced Pipeline (Popen): When another program is started as a new process in the current program process, it is considered a sub-process of the current program, which we become the advanced pipeline method.
    • Famous pipe (named pipe): A well-known pipe is also a half-duplex mode of communication, but it allows communication between unrelated processes.
    • Message Queuing: Message Queuing is a linked list of messages, stored in the kernel and identified by message queue identifiers. Message Queuing overcomes the disadvantages of less signal transmission information, only unformatted byte stream, and limited buffer size.
    • Semaphore (Semophore): Semaphore is a counter that can be used to control access to shared resources by multiple processes. It is often used as a locking mechanism to prevent a process from accessing the shared resource while other processes are accessing the resource. Therefore, it is primarily used as a means of synchronization between processes and between different threads within the same process.
    • Signal (sinal): A signal is a more complex form of communication that notifies the receiving process that an event has occurred.
    • Shared memory: Shared memory is the mapping of memory that can be accessed by other processes, which is created by a process, but can be accessed by multiple processes. Shared memory is the fastest IPC approach and is specifically designed for low-efficiency operation of other interprocess communication modes. It is often used with other communication mechanisms, such as signal two, to achieve synchronization and communication between processes.
    • Socket (SOCKET): Socket is also an inter-process communication mechanism, unlike other communication mechanisms, it can be used for process communication between different machines.

Ways to communicate between processes

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.