In the Linux world, there are many interprocess communication (IPC) methods available for system programmers. After some web searching, I found that there are rarely blogs or books that summarize them all. This article roughly lists them all with minimal explanation and some links to official manuals.
POSIX IPCs
POSIX-flavor IPCs include semaphores, shared memory, and message queues.
semaphore
There are also two subtypes of semaphores: named and unnamed. For details, see man 7 sem_overview.
sem_getvalue(3)sem_post(3)sem_wait(3)sem_trywait(3)sem_timedwait(3)sem_open(3) // namedsem_close(3) // namedsem_unlink(3) // namedsem_init(3) // unnamedsem_destroy(3) // unnamed
shared memory
POSIX shared memory (shm) IPC only has named version, the shm objects are stored in Linux tmpfs (by default /dev/shm).
shm_open (3)shm_unlink (3)
message queue
POSIX message queue (mq) IPC objects are also named, but they are stored in a special filesystem, mqueue. A mqueue filesystem can be mounted with the following command,
mount -t mqueue none /dev/mqueue
The libc APIs and their syscall counterparts are listed below, details see man 7 mq_overview.
Library interface System callmq_close(3) close(2)mq_getattr(3) mq_getsetattr(2)mq_notify(3) mq_notify(2)mq_open(3) mq_open(2)mq_receive(3) mq_timedreceive(2)mq_send(3) mq_timedsend(2)mq_setattr(3) mq_getsetattr(2)mq_timedreceive(3) mq_timedreceive(2)mq_timedsend(3) mq_timedsend(2)mq_unlink(3) mq_unlink(2)
SystemV / XSI IPCs
Similar to the POSIX IPCs, SystemV/XSI-flavor IPCs have the same three types IPCs under Linux: semaphore, shared memory, and message queue. For details, see man 7 sysvipc.
semaphore
semget(2) // Create a new set or obtain the ID of an existing set. This call returns an identifier that is used in the remaining APIs.semop(2) // Perform operations on the semaphores in a set. semctl(2) // Perform various control operations on a set, including deletion.
shared memory
shmget(2) // Create a new segment or obtain the ID of an existing segment. This call returns an identifier that is used in the remaining APIs. shmat(2) // Attach an existing shared memory object into the calling process's address space. shmdt(2) // Detach a segment from the calling process's address space. shmctl(2) // Perform various control operations on a segment, including deletion.
message queue
msgget(2) // Create a new message queue or obtain the ID of an existing message queue. This call returns an identifier that is used in the remaining APIs. msgsnd(2) // Add a message to a queue. msgrcv(2) // Remove a message from a queue. msgctl(2) // Perform various control operations on a queue, including deletion.
UNIX IPCs
There are some IPCs widely implemented in UNIX-like OSs, but not specified in the POSIX standard. These include pipe, FIFO, signal, and unix domain socket.
Pipe & FIFO
The pipe IPC and FIFO are fundamentally the same, except that FIFO is named while pipe is not.
popen(3) // pipe pclose(3) // pipe mkfifo(3) // FIFO mkfifoat(3) // FIFO
Signal
For details see man 7 signal.
signal(2) sigaction(2) kill(2) sigprocmask(2) sigpending(2) sigsuspend(2) // and more ...
Unix Domain Socket
Unix domain sockets (UDS) use the socket programming interface for local IPC. For details, see man 7 unix.
socket(AF_UNIX, ...) (2)
Modern Linux IPCs
Binder
The binder IPC was initially implemented for the Android OS and has been merged into Linux upstream.
For details, see The Android binderfs Filesystem — The Linux Kernel documentation.
DBus / kdbus
The DBus IPC is now widely used. It is implemented in userspace. Efforts are made towards a kernel version (kdbus), but it has not been merged upstream. For details, see dbus (www.freedesktop.org).
Assigning your copyright to the FSF helps defend the GPL and keep software free. Thanks to Ignacio Ruiz Cejudo, Johan Sternerup, Rens Oliemans, Robert Burks, Sergei Golovin, and Toshihiro Umehara for assigning their copyright to the FSF! #GDB #Emacs #GNUAstro #GNUstep More: https://u.fsf.org/3ht #CopyrightAssignments
This article from Cory Doctorow reminds us that DRM isn't just oppressive (and defective) by design -- it carries serious risks to our freedom and privacy: https://u.fsf.org/3vg #DefectiveByDesign #EndDRM
FOSS audio software Pipewire has been updated to version 1.2. This update adds support for asynchronous processing, earlier and improved reporting of config parsing errors, support for making and using multiple data-loops, and more. The code is licensed using the MIT license.
The main project website is here:
The source code is available on Gitlab:
https://gitlab.freedesktop.org/pipewire/pipewire
The release notes for this update is here:
https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/1.2.0
The project has a presense on Mastodon:
https://fosstodon.org/@pipewire
If you want to help the project financially they accept donations through Liberapay:
Physics based tank game "Toy Tanks" is now available on GOG. It was originally released back in 2022. It has a native Linux version and is now available DRM free.
This week's donation went to the Devuan project. It's a Linux distro based off Debian which not only doesn't use SystemD but during install gives the user a choice between SysVinit, Runnit, and OpenRC. If you use the netinstaller option you also get a choice of desktop environments during install including XFCE, Cinnamon, Gnome, KDE, LXDE, LXQT and Mate. It can also easily be used with the libre kernel if one wanted to if you follow the instructions at FSFLA. It uses the Ext file system by default. The latest release is called Daedalus which is based off Debian 12 but you can install Excalibur which is based off Debian testing if one needed newer packages. Overall it is a great option if one wants a distro giving them more freedom of choice during install.
The project's main website is here:
The project has a forum here:
The project accepts donations through Paypal, crypto and bank transfer if you wish to help financially:
I have been gaming since 1992 and building PCs since 2003. I enjoy Linux, supporting FOSS projects and am a tinfoil hat connoisseur.
Many FOSS projects rely on donations. If you have money to spare but don't know which to donate to take a look at the above links on Ko-fi, Github, and Open Collective. Anything on there that I have sponsered or contributed to is something I have found to be worthy.