Beej's Guide to Interprocess Communication
beej.us
beej.us
Beej's System V IPC Guide - https://news.ycombinator.com/item?id=36046014 - May 2023 (1 comment)
Beej's Guide to Unix IPC (2015) - https://news.ycombinator.com/item?id=29829483 - Jan 2022 (54 comments)
Beej's Guide to Unix IPC (2010) - https://news.ycombinator.com/item?id=9619375 - May 2015 (31 comments)
Beejs Guide to Unix IPC - https://news.ycombinator.com/item?id=1525227 - July 2010 (19 comments)
Beej's Guide to Unix Interprocess Communication - https://news.ycombinator.com/item?id=978558 - Dec 2009 (20 comments)
https://news.ycombinator.com/item?id=29829483 ("Beej's Guide to Unix IPC")—Jan. 2022 (54 comments)
It's definitely on the list to figure out how to build as a site feature though—perhaps a sort of community curation thing.
There was nothing like it elsewhere
Having a well-written tutorial on one page, with no monthly fees, licensing, SEO, or ads (and someone who actively responds to emails!)... that's still quite rare, at least in my experience.
I had to add an extra sigaction to handle SIGINTs but nothing huge.
Thank you so much for this guide.
If you can't get enough Linux systems fundamentals, give Robert Love's Intro to Linux Systems Programming a try. It goes through IPC (but not in this much detail) and a good swath of Linux fundamentals, all in C.
C language is probably one of the most apt languages to write "timeless" software, and the Sockets api have been fairly stable over the years (although i know that the Beej's guide use some newer apis, mostly getaddrinfo).
I was incredibly surprised when going through the source code of gnu make to find some incredibly old C syntax that happily compiled and is used today by pretty much everyone (one way or another).
> If you can't get enough Linux systems fundamentals, give Robert Love's Intro to Linux Systems Programming a try.
Interesting, I will! Thanks!
I have spent a lot of time recently doing hobbyist programming with multithreaded ringbuffers and barriers for concurrency and I'm still looking for a golden abstraction that is easy to reason about - and doesn't suffer from low level mutexes and worrying about memory ownership when transferring data between threads or processes.
I really like the ideas behind Smalltalk about communicating objects and the composition of "behaviours" through communication of objects. I have never used Dbus but I think that's kind of similar.
And I think The COM object model and Mozilla's XPCOM model are similar ideas that were tried which is about a standard protocol for object communication and initialisation.
It reminds me of the perennial userspace vs kernel debate, microkernels vs monolithic kernels. How do you efficiently communicate between programs? And how do you efficiently communicate between parts of the same program without coupling them?
Every programming language defines its own semantics. You kind of need to serialize and deserialize data sent between programs for safety.
A procedure call (CALL instruction) is efficient communication with registers and the stack and it controls flow directly and isn't parallel. A coroutine is efficient communication at runtime between two or more regions of code. What do you think?
Would love to hear what other people are doing in this space and how you've used interprocess communication or even Dbus.
Programming are the mental models and languages to facilitate that action.
Where do you see God in all this :-)
As slippery as that intuition is, I tend to find truth in neither what god is nor isn’t. For any descriptor isn’t. But whatever that is, may or may not be.
In retrospect, God feels similar to a holy donut. a torus both manifested in form at the magnetic plane and invisible in the hyperbolic giving rise to primordial motion. Simultaneously inside and outside.
He is simultaneously inside us and we are inside Him like you say and He is Holy and hides Himself from the wisdom of the world.
Then there’s the whole Bible declaring itself as a LLM bit as a recursive definition of god, word, and flesh. So there’s that.
As someone who deals with a difficult illness (schizophrenia) I know what it is to receive messages from the darkness which I reject and resist. But I pick LIGHT and LOVE and God.
Not to mention that just because you're only developing for Linux doesn't guarantee you'll have Binder or D-Bus.
Yes, which is why I highlighted that it is incomplete if you are not limiting yourself to just POSIX. It's important for readers to understand the scope of what is contained in the guide as it would be easy to think this is all the IPC mechanisms Linux offers.
>developing for Linux doesn't guarantee you'll have Binder or D-Bus
This is technically true, but everywhere Linux is used will likely already have one of them: embedded, mobile, desktop, server, etc. For D-Bus you can even have it work in a peer to peer mode where you don't need the daemon.
https://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html
Well that’s silly. If the portable options can do it for you, use those.
What I personally find silly is every service rolling there own protocol making it harder for clients to use existing libraries to talk to them and making more work for themselves to get to a quality IPC solution. It usually just ends up in getting something half baked.
There’s nothing inherently “proper” to using platform specific options, but perhaps that’s not even the issue here. It’s a beginner tutorial. A “concise overview of various IPC techniques” with examples that “should compile anywhere a good Unix compiler is available.” What you’re talking about isn’t part of the mission.
Just as you shouldn't let a crop go monoculture, your software should not all be built on one or two pieces of tech.
What happens when dbus is replaced? Now you have to move onto the new, broken thing, and change your code to adapt, giving control to others over your program.
There are valid reasons to not just cargo cult dbus.
D-Bus is how XDG and Red Hat software gets onto a Linux system. Without dbus, lots of software with braindead design can stay off of your machine.
PIDs, sockets, FIFOs, and other similar constructs can achieve IPC just fine.