News for hackers. Stuff that matters.
Re:Bus1: a new Linux interprocess communication proposal by nixos on Thursday August 18, 2016 @12:21AM (#12310405)
Can someone please explain what's wrong with the classical UNIX sockets and pipes that they need to invent and (re)invent dbus, bonobo, now bus1?
Re:Bus1: a new Linux interprocess communication proposal by chubot on Thursday August 18, 2016 @02:10AM (#12310686)
I'm very sympathetic to that point of view -- UNIX is a paradox where everybody uses it but most people don't really know how to use it.

But this paper makes a good quantitative case for POSIX not meeting the needs of modern computing: https://news.ycombinator.com/item?id=11652609

A good example is that Linux distros, Android, and OS X all have their own non-POSIX IPC mechanisms. Applications are somehow voting with their feet and not using Unix domain sockets and pipes.

It leaves me scratching my head because I don't think serialization is that hard a problem. But it seems that most people want IPC with structured data. Android is a bit of a special case because it's a single-language OS.

"Traditional POSIX threading models, IPC interfaces, and file system access are being replaced by platform and vendor-specific APIs and frameworks such as Grand Central Dispatch [18], Binder [29], DBus [25], and SQLite [1]."

Re:Bus1: a new Linux interprocess communication proposal by naasking on Thursday August 18, 2016 @08:46AM (#12312047)
> It leaves me scratching my head because I don't think serialization is that hard a problem.

It is a hard problem, at least if you want to achieve concision, make it parseable, and support schema upgrade.

> "Traditional POSIX threading models, IPC interfaces, and file system access are being replaced by platform and vendor-specific APIs and frameworks such as Grand Central Dispatch [18], Binder [29], DBus [25], and SQLite [1]."

And good riddance. File systems are almost universally terrible [1]. Threading with shared state is also a terrible idea because it's too general, not to mention the poor APIs used to manage them.

IPC is something that's still unfortunately undergoing constant revision, and the structured binary vs. text wars unfortunately both have merit. I think structured text output via a domain-specific language (DSL) is really the proper answer, somewhat like how a REPL works. This DSL is ultimately simple to construct within C since it would be lisp-like in its structure so it doesn't need an IDL compiler, although its textual syntaz shouldn't be lisp-like.

stdin can then nicely format DSL output for the user. Best of all worlds between text, binary, and structured formats.

[1] https://danluu.com/file-consistency/

Re:Bus1: a new Linux interprocess communication proposal by goalieca on Thursday August 18, 2016 @10:12AM (#12312581)
Serialisation is its own problem. Should have nothing to do with IPC. Layered architectures out the window in favour of systemd like monoliths.
Re:Bus1: a new Linux interprocess communication proposal by naasking on Thursday August 18, 2016 @10:55AM (#12312929)
> Serialisation is its own problem. Should have nothing to do with IPC.

Yes and no. There's significant utility to standardizing serialization in your IPC layer. IPC consists of exchanging domain-specific messages, so the message types can be specified in a header shared between endpoints, and data gets serialized in a standard format.

The IPC API then simply reduces to sending/receiving data to/from endpoints, like channels in CPS. And ideally it should be higher-order so you can send an endpoint to another endpoint.

So you don't need to standardize the serialization, but then you just get a plethora of incompatible formats.

Re:Bus1: a new Linux interprocess communication proposal by pjmlp on Thursday August 18, 2016 @04:44AM (#12311154)
> UNIX is a paradox where everybody uses it but most people don't really know how to use it.

Specially when the majority nowadays has the idea that GNU/Linux == UNIX and never tried to write an actual portable UNIX application.

Re:Bus1: a new Linux interprocess communication proposal by saynsedit on Thursday August 18, 2016 @08:42AM (#12312012)
Eh? The majority of modern POSIXy software runs on at least Linux, Mac OS X, and FreeBSD.

In fact, Mac OS X is the most widely deployed UNIX-like system ever. What you're a claiming to be true probably more applies to Mac OS X than Linux.

I honestly haven't seen a recent package that was accidentally not portable in the long-term across the various modern UNIX-like systems because of confusion of Linux for POSIX.

Re:Bus1: a new Linux interprocess communication proposal by cgag on Thursday August 18, 2016 @02:29PM (#12315126)
Have you used FreeBSD? Having played with Free/Open/DragonflyBSD, I came away shocked at how non-portable most software is.
Re:Bus1: a new Linux interprocess communication proposal by saynsedit on Thursday August 18, 2016 @03:23PM (#12315606)
Any examples? Even Debian packages include custom patches.
Re:Bus1: a new Linux interprocess communication proposal by pjmlp on Thursday August 18, 2016 @09:30AM (#12312315)
There are more UNIX flavours than those ones.
Re:Bus1: a new Linux interprocess communication proposal by saynsedit on Thursday August 18, 2016 @09:51AM (#12312433)
Irrelevant, if the vast majority of modern packages work with the big three, it's highly likely they work with other conforming POSIX systems.
Re:Bus1: a new Linux interprocess communication proposal by pjmlp on Thursday August 18, 2016 @11:09AM (#12313051)
The keyword being likely.

I don't miss my days of writing portable POSIX code across DG/UX, Solaris, HP-UX, Aix, FreeBSD, Red-Hat, Debian and the respective #ifdefs.

Re:Bus1: a new Linux interprocess communication proposal by saynsedit on Thursday August 18, 2016 @11:21AM (#12313156)
This is still irrelevant.

You were asserting that the majority of programmers think Linux == UNIX and have never tried to write a portable application.

Thst is clearly false as the majority of programmers probably confuse Mac OS X for UNIX and most modern unix-like software is portable to at least Linux, Mac OS X, and FreeBSD. Portable is more general than "portable across every UNIX that has existed."

Increasing the specificity of your argument mid-way to avoid the incorrectness of your initial general argument isn't very genuine.

But yes, your revised second statement is probably correct: most UNIX programmers have never tried writing portable code across "DG/UX, Solaris, HP-UX, Aix, FreeBSD, Red-Hat, Debian" exactly because there is no practical reason for it.

Re:Bus1: a new Linux interprocess communication proposal by pjmlp on Thursday August 18, 2016 @02:13PM (#12314987)
Other than sell software to enterprise customers.
Re:Bus1: a new Linux interprocess communication proposal by saynsedit on Thursday August 18, 2016 @03:22PM (#12315584)
Sure, you're correct on that. Thanks for staying on topic.
Re:Bus1: a new Linux interprocess communication proposal by ndesaulniers on Thursday August 18, 2016 @03:45AM (#12310960)
In Binder's case, it makes RPC between different languages significantly easier.

You can't pass file descriptors over sockets. You can't do RPC over pipes. Anonymous sockets can only be shared with children. Named sockets require write permission and a filesystem. SysV is prone to resource leaks.

Binder has authentication, shared memory, reference counting, weak references, dead object notifications.

The descriptors and authentication part is key, as it allows Android's trusted system_server to open a device or socket for an untrusted process such as an App if it has user permissions. The receiver of a binder request can check the requester's PID/GID and with confidence from the kernel.

Most importantly, I don't think it's healthy to think of POSIX as being done. Some experimentation and discovery of better APIs and better systems should be encouraged.

gah, I'm driving myself crazy; I swear I saw somewhere a diagram of the Taxonomy of Unix IPC Mechanisms, with most of them crossed out and replaced simply with binder, please help me find it!

Re:Bus1: a new Linux interprocess communication proposal by ahoka on Thursday August 18, 2016 @04:48AM (#12311168)
> You can't pass file descriptors over sockets.

You can:

http://man7.org/tlpi/code/online/dist/sockets/scm_rights_sen...

Re:Bus1: a new Linux interprocess communication proposal by justin66 on Thursday August 18, 2016 @08:48AM (#12312061)
Nice. I've used that book and recommend it to people but I've never seen that before. I don't know how I would find it, either, since it doesn't appear to be indexed anywhere.
Re:Bus1: a new Linux interprocess communication proposal by dozzie on Thursday August 18, 2016 @04:23AM (#12311058)
> You can't pass file descriptors over sockets.

Good that my code doesn't know this. It would stop working.

> The descriptors and authentication part is key, [...]

If by "authentication" you mean "checking PID/UID/GID", we already have both in unix sockets.

Re:Bus1: a new Linux interprocess communication proposal by CJefferson on Thursday August 18, 2016 @04:43AM (#12311150)
How do you pass a file descriptor through a socket? They just take bytes?

If you mean "I send some bytes that describes the file to open, and keep my processes in sync manually", of course you can do that, but true passing would allow a number of cool things.

Re:Bus1: a new Linux interprocess communication proposal by ahoka on Thursday August 18, 2016 @04:49AM (#12311173)
By passing it as ancillary data: http://linux.die.net/man/3/cmsg
Re:Bus1: a new Linux interprocess communication proposal by saynsedit on Thursday August 18, 2016 @09:01AM (#12312143)
Re:Bus1: a new Linux interprocess communication proposal by Nursie on Thursday August 18, 2016 @07:07AM (#12311564)
You absolutely can do RPC over pipes.

I've seen that done several times, with defined request and response message formats.

Re:Bus1: a new Linux interprocess communication proposal by Pyxl101 on Thursday August 18, 2016 @12:49AM (#12310476)
The design goals of bus1 are described here: https://lists.linuxfoundation.org/pipermail/ksummit-discuss/...

Some call-outs for you:

> * efficiently support n-to-n communication. * be well-suited for both unicast and multicast messages. * guarantee a global message order. * avoid any in-kernel buffering and rather transfer data directly from a sender into the receiver's mappable queue (single-copy).

The downside of the alternatives that you mention is that they're not available as kernel features in Linux. Bus1 is inspired by that previous work and aims to make a new attempt at inclusion in the kernel, which they believe is required to provide the features they're targeting:

> A user-space implementation of bus1 (or even any bus-based IPC) was considered, but was found to have several seemingly unavoidable issues.

> o To guarantee reliable, global message ordering including multicasts, as well as to provide reliable capabilities, a bus-broker is required. In other words, the current linux syscall API is not sufficient to implement the design as described above in an efficient way without a dedicated, trusted, privileged process that manages the bus and routes messages between the peers. (...)

Re:Bus1: a new Linux interprocess communication proposal by pjc50 on Thursday August 18, 2016 @02:12AM (#12310691)
Global message order sounds like the kind of commitment that becomes increasingly expensive in a multi core environment..
Re:Bus1: a new Linux interprocess communication proposal by grandinj on Thursday August 18, 2016 @03:56AM (#12310994)
hence the use of some nifty optimised clocking algorithms:

https://github.com/bus1/bus1/wiki/Message-ordering

Re:Bus1: a new Linux interprocess communication proposal by tomegun on Thursday August 18, 2016 @09:14PM (#12317388)
The overhead due to the message ordering is constant, irrespective of the number of cores/peers. See the link posted above for an explanation.
Re:Bus1: a new Linux interprocess communication proposal by digi_owl on Thursday August 18, 2016 @02:54AM (#12310806)
Because the automotive industry wants to move from QNX to Linux, and wants to use dbus like they used QNX IPC beforehand. Thus we have projects like streaming video over dbus(?!).

https://lwn.net/Articles/551969/

Re:Bus1: a new Linux interprocess communication proposal by cnvogel on Thursday August 18, 2016 @04:04AM (#12311011)

    > Large automotive companies have built huge systems on top of QNX
    > messages, creating large libraries used by their applications.
    > They would like to be able to use those libraries 
    > on Linux, but often don't know that there is
    > a way to get the QNX message API for Linux. It is called SIMPL
    > and it works well.
(from the LWN article)
Re:Bus1: a new Linux interprocess communication proposal by cm3 on Thursday August 18, 2016 @09:53AM (#12312448)
And the reason this is more prevalent on QNX is that it's a microkernel based platform. Here, in Linux, there's the debate what should be allowed into the kernel, whereas that question is pretty much never asked for QNX. You also don't get discussions about circumventing the kernel network stack to avoid context switches, to name a prominent example. Microkernels also lend themselves better to multikernel designs where you aim to make better use of all the available cpu cores by reducing sharing.
Re:Bus1: a new Linux interprocess communication proposal by rwmj on Thursday August 18, 2016 @09:37AM (#12312355)
It's a shame that QNX is dying inside Blackberry. If there's one project I would love to see open sourced, it is QNX.
Re:Bus1: a new Linux interprocess communication proposal by hobo_mark on Friday August 19, 2016 @08:04AM (#12319446)
They tried to open it for a short period, I remember getting the sources and playing with it:

http://www.qnx.com/news/pr_2471_1.html

And now I notice it was almost ten years ago! Nevertheless, too little too late...

Re:Bus1: a new Linux interprocess communication proposal by the_why_of_y on Thursday August 18, 2016 @08:53AM (#12312092)
AF_UNIX sockets don't do multi-cast.

AF_INET sockets don't do FD passing or credentials.

There was a patch to add an AF_BUS socket family some years ago that sounded like a pretty general solution but the network maintainer said "over my dead body".

http://lwn.net/Articles/504970/

Re:Bus1: a new Linux interprocess communication proposal by rodgerd on Thursday August 18, 2016 @12:31AM (#12310432)
> what's wrong with the classical UNIX sockets

Well, for starters they're a bolt-on that doesn't fit with the actual classic Unix philosophy.

Re:Bus1: a new Linux interprocess communication proposal by cyphar on Thursday August 18, 2016 @05:25AM (#12311265)
You couldn't send credentials nor file descriptors to other processes without UNIX sockets. I would argue that allowing for that kind of decoupling of permissions and file access is very much in the spirit of the UNIX philosophy. Quite frankly, there are some problems you simply wouldn't be able to solve without them (in runC, the underlying runtime that Docker wraps, we use them quite extensively).
Re:Bus1: a new Linux interprocess communication proposal by gens on Thursday August 25, 2016 @04:03PM (#12362030)
You can send fd's through UDS and they do expose a lot of info on the process on the other side.

http://www.thomasstover.com/uds.html

Re:Bus1: a new Linux interprocess communication proposal by amscanne on Thursday August 18, 2016 @12:34AM (#12310442)
AFAIK, there's no good way to "broadcast" messages without bouncing through a user space co-ordinator. The current primitives just don't match this kind of need. Presumably, this inefficiency could be a bottleneck for some cases and eliminating the extra step might help, plus a kernel implementation could be simpler (no extra daemons, etc.)
Re:Bus1: a new Linux interprocess communication proposal by bitwize on Thursday August 18, 2016 @01:09AM (#12310525)
I wrote a proof of concept that does multicast using the file system and inotify. A bit hacky and there are drawbacks, but it works.
Re:Bus1: a new Linux interprocess communication proposal by wahern on Thursday August 18, 2016 @02:25AM (#12310734)
1) They want better performance over the existing solutions. For better or worse applications are [arguably] abusing the heck out of D-Bus. Using regular files might help with huge messages, but it's a lot of overheard for many small messages.

2) They want the ability to insert a broker that manages permissions among the peers, but have the kernel enforce those permissions on a per message basis so the broker doesn't become a bottleneck. That's not easy to with the filesystem.

I mean, strictly speaking it's theoretically possible using the file system considering that in practice the only real broker would be systemd with a fixed set of policies, so theoretically the traditional Unix model of user, group, and supplementary groups would suffice by assigning users and processes into the proper groups, and binding message files into protected group-readable directories. But for whatever pretense, people want the solution to implement a system of opaque, ephemeral identifiers/capabilities.

It sort of reminds me of SMF, launchd, systemd, and similar changes. For example, I was installing Solaris 11.3 on a VM yesterday and was trying to figure out how to set the hostname. You used to set it by storing the hostname to /etc/nodename. Now it's stored in some opaque tree data structure deep in the bowels of SMF, which you set with some long and impenetrable command-line utility invocation. You can still set /etc/nodename; if no hostname is configured then SMF will initialize the hostname from /etc/nodename and delete the file. It boggles the mind.

Re:Bus1: a new Linux interprocess communication proposal by amscanne on Friday August 19, 2016 @02:06PM (#12322020)
That's clever, but there are reasons a purpose-built subsystem could be a better a fit:

* Inotify events are coalesced. Great for notifications, may be bad for discrete messages.

* The sender may want information about # of messages sent, synchronous delivery, etc.

Re:Bus1: a new Linux interprocess communication proposal by thwarted on Thursday August 18, 2016 @02:11AM (#12310688)
How's it perform on tmpfs or ramdisk?
Re:Bus1: a new Linux interprocess communication proposal by pjmlp on Thursday August 18, 2016 @04:42AM (#12311139)
The UNIX War is dead, long live the GNU/Linux war.

Ergo, POSIX wasn't the end.

Re:Bus1: a new Linux interprocess communication proposal by Philipp__ on Thursday August 18, 2016 @07:00AM (#12311547)
Because Linux people like to reinvent the wheel! :)