Linux inter-process communication overview

Source: Internet
Author: User
Tags unix domain socket
Linux inter-process communication is mainly divided into the following four fields (1) message transmission (pipeline, FIFO, message queue) (2) synchronization (mutex lock, conditional variable, read/write lock, semaphore) (3) shared memory area (anonymous shared memory area, famous shared memory area) (4) process calling (Solaris gate, SunRPC) information between linux processes

Linux inter-process communication is mainly divided into the following four areas
(1) message transmission (pipeline, FIFO, message queue)
(2) synchronization (mutex lock, condition variable, read/write lock, semaphore)
(3) shared memory zone (anonymous shared memory zone, famous Shared Memory Zone)
(4) process call (Solaris gate, Sun RPC)


Information sharing between linux processes can be divided
(1) file system-based sharing
(2) kernel-based sharing
(3) shared memory zone-based sharing


Continuity of IPC objects
(1) the continuous IPC object between processes persists until the last process that opens the object closes the object.
(2) the IPC object that persists with the kernel until the kernel is restarted or explicitly deleted.
(3) an IPC object that persists with the file system until it is displayed and deleted. This object still exists even if the system Auto-uploads it.


IPC type persistence
Pipeline with process
FIFO with process

Posix mutex lock with process
Posix condition variable with process
Posix read/write lock with process
Fcntl records locks with processes

Posix message queue with kernel
Posix famous semaphores with kernel
Posix memory-based semaphore with process
Posix Shared Memory zone with kernel

System V message queue with kernel
System V semaphore with kernel
System V shared memory zone with kernel

TCP socket with process
UDP socket with process
Unix domain socket with process

 

 

 

Namespace:
When two or more unrelated processes exchange information with each other using some type of IPC object, the IPC object must have a certain form of name or identifier, in this way, a process (usually a server) can create this IPC object, while other processes can specify the same IPC object.

The IPC type is used to open or create the ID of the namespace after IPC is opened.
Pipeline has no name descriptor
FIFO path name descriptor

Posix mutex lock no name pthread_mutex_t pointer
Posix condition variable has no name pthread_cond_t pointer
Posix read/write Lock No name pthread_rwlock_t pointer
Fcntl record the locking path name descriptor

Posix message queue Posix IPC name mqd_t value
Posix famous semaphores Posix IPC name sem_t pointer
Posix memory-based semaphores Have No Name sem_t pointer
Posix Shared Memory Zone Posix IPC name descriptor


System V message queue key_t Key System v ipc identifier
System V semaphore key_t Key System v ipc identifier
System V shared memory key_t Key System v ipc identifier

Path name descriptor
Sun RPC program/version RPC handle

TCP socket IP address and TCP port descriptor
UDP socket IP address and UDP port descriptor
Unix domain socket path name descriptor

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.