One, the local process of communication between:
1. Piping (pipe)
Pipeline files can be used to communicate inter-process data, which is usually the way of communication between parent-child processes that have blood relationships.
Pipeline communication is half-duplex, and the parent-child process can read and write to the pipeline file by invoking the read () and write () commands in the kernel.
Pipeline communication is based on files within the hard disk, so I/O speed is low.
2. Message Queuing
Message Queuing is a linked-list-like data structure that is stored in memory, so I/O speeds are faster than pipelines, and the IPCS-Q command allows you to view the message queues that are created in the current system.
Multiple different processes can communicate using the same message queue, the data in the message queue is stored in blocks, each piece of data has a specific mtype, and the process must specify a specific mtype when sending and receiving data.
3. Signal Volume
Synchronization and mutual exclusion for processing processes:
Synchronization: The sequencing of process execution is strictly scheduled
Mutex: Two processes can not use the same resource (code snippet) at the same time, can be said to be a special synchronization
The semaphore can be interpreted as a counter, when there is a process request to use the semaphore, it counts 1 (P operation), when the counter is 0 indicates that there is no resource at this time, other processes to access must wait, when a process is finished using the resource, it counts +1 (v operation).
4. Shared Memory
Similar to Message Queuing, but the operation is more concise, the IPCS-M command allows you to view the shared memory area that is created in the current system.
When a process wants to use a shared memory area, it needs to create a link to that shared memory first.
Ii. communication between different host processes (network communication)
Communication is made through a pair of sockets for two hosts, which consists of an IP address and a port number, and a socket identifies a specific process for a particular host.
The server process creates the socket and sets it to the listening state, a process known as a daemon.
The client then creates the socket that is used to request the link, making a link request to the socket that the server is listening on, thereby establishing the link.
Introduction to communication methods between Linux processes