Process communication methods and processes

Source: Internet
Author: User

Process communication methods and processes

Several methods of inter-process communication:

1. Normal pipeline (pipe): pipeline is a standalone communication method. data can only flow in one direction and can only be used between unrelated processes. The kinship of a process usually refers to the relationship between a parent-child process or a sibling process.

2. Stream pipeline (s_pipe): A half-duplex communication mode that supports bidirectional transmission.

3. named pipe: A famous pipe is also a half-duplex communication method, but it allows communication between unrelated processes.

4. semophore: a semaphore is a counter that can be used to control access to shared resources by multiple processes. It is often used as a lock mechanism to prevent other processes from accessing a shared resource. Therefore, it is mainly used for synchronization between processes and between different threads in the same process.

5. message queue: a message queue is a linked list of messages stored in the kernel and identified by the message queue identifier. The message queue has overcome the disadvantages of few signal transmission information, the pipeline can only carry non-Format byte streams, and the limited cache size.

6. signal: a signal is a complex communication method used to notify the receiving process that an event has occurred.

7. shared memory: the shared memory is the memory mapped to a segment that can be accessed by other processes. The shared memory is created by one process, but can be accessed by multiple processes. Shared memory is the fastest IPC method. It is specially designed for the low efficiency of communication between other processes. It is often used with other communication mechanisms, such as semaphores, to achieve synchronization and communication between processes.

8. socket: A socket is also a mechanism for inter-process communication. Different from other communication mechanisms, it can be used for different and inter-process communication.



Which of the following methods can be used for inter-process communication in linux?

# Pipe: a pipe is a half-duplex communication method. data can only flow in one direction and can only be used between unrelated processes. The kinship of a process usually refers to the parent-child process relationship.
# Named pipe: A famous pipe is also a half-duplex communication method, but it allows communication between unrelated processes.
# Semophore: a semaphore is a counter that can be used to control access to shared resources by multiple processes. It is often used as a lock mechanism to prevent other processes from accessing a shared resource. Therefore, it is mainly used for synchronization between processes and between different threads in the same process.
# Message queue: a message queue is a linked list of messages stored in the kernel and identified by the message queue identifier. The message queue has overcome the disadvantages of few signal transmission information, the pipeline can only carry unformatted byte streams, and the limited buffer size.
# Signal (sinal): a signal is a complex communication method used to notify the receiving process that an event has occurred.
# Shared memory: the shared memory is the memory mapped to a segment that can be accessed by other processes. The shared memory is created by one process, but can be accessed by multiple processes. Shared memory is the fastest IPC method. It is specially designed for the low efficiency of communication between other processes. It is often used with other communication mechanisms, such as signal two, to achieve synchronization and communication between processes.
# Socket: the socket is also a mechanism for inter-process communication. Different from other communication mechanisms, it can be used for different and inter-process communication.

Which communication methods are available between processes?

Inter-process communication

Normal PIPE
Stream PIPE
Name PIPE (FIFO)
Message Queue
Semaphores
Shared storage
UNIX stream SOCKET
UNIX PACKET SOCKET

Related Article

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.