Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>I've decided to take matters into my own hands. I am writing a new bus.

Why not reuse Binder which has been to deployed to billions of devices, being a core part of a serious OS, with many many more developers who understand it compared to dbus.

You would probably want to write your own service manager, but you can reuse hardened stuff that already exist.





Yes! Make something built on top of binder, and use something with orders of magnitude more users and developer resources behind it..

> hardened stuff that already exist.

To make it even more hardened(?), Google recently contributed and got merged a Rust implementation of binder for the Linux kernel (and they're apparently planning to eventually remove the old C implementation).

https://lwn.net/Articles/953116/

https://lore.kernel.org/rust-for-linux/20231101-rust-binder-...


There are few implementations of the Binder userspace outside of Android.

Not widely known but the original Binder, OpenBinder, was not even for Linux or Android It was developed for BeOS.

OpenBinder was one of the few pieces of code which was open sourced in Be Inc’s dying days just before it was acquired by Palm.

Many of the principal Be developers who worked on OpenBinder, Dianne Hackborn, Jean-Baptiste Queru, et al then moved from Palm to Danger, which was developing Android and which was later acquired by Google.

And the rest, as they say, is history.


How many implementations existed of their new bus?

Considering that any new implementation of Binder userspace would realistically also be incompatible with Android Binder, what would really be the gain here? You'd basically have yet another wire protocol that nobody else uses but now also depends on having a obscure Linux feature enabled.

Why would it need to be a new implementation? AOSP is like... right there, and it's not like libbinder has crazy dependencies.

> also depends on having a obscure Linux feature enabled

An extremely widely used and battle hardened Linux feature, though, with corporate sponsorship and active development. With the only real reason it's obscure on desktop linux at all is because upstream blocked it for a long time. If desktop linux embraced it, it certainly wouldn't be obscure anymore, now would it?


Most of binder is in outright Java. Libbinder_ndk is a subset that is unlikely to please anybody. The other libbinder (openbinder) is dead since 2006ish. I actually used this last one in certain commercial product.

> An extremely widely used and battle hardened Linux feature, though, with corporate sponsorship and active development.

Compared to _unix sockets_ , which is the other transport used by almost every other local IPC mechanism, and also what D-Bus uses, there is just no contest. Even Android uses unix sockets more than Binder.


> Most of binder is in outright Java

None of binder is in Java. The Java binder code is just JNI bindings to the native implementation.

Things like permission manager are in Java, but that's not part of binder. It's just a service published on binder, and one that wouldn't translate to current desktop Linux anyway.

> Compared to _unix sockets_ , which is the other transport used by almost every other local IPC mechanism, and what both D-Bus, TFA's proposal, and literally any other reasonable desktop IPC proposal out there, there is just no contest.

unix sockets are not an equivalent, which is why protocols are bolted on top to turn it into dbus, etc...

EDIT:

> The other libbinder (openbinder) is dead since 2006ish.

The libbinder I meant is the one in AOSP hence why I said "AOSP is right there":

https://cs.android.com/android/platform/superproject/main/+/...

That one is very definitely not dead since 2006ish.


"None of binder is in Java" is too strong a statement: https://android.googlesource.com/platform/frameworks/base/+/...

This libbinder is still way too Java-centric. It can be used from outside, and even slightly reminds me of openbinder (e.g. sp<> https://cs.android.com/android/platform/superproject/main/+/... ) but it doesn't really change the picture much. You have something which smells Java from a mile, and has a lot of other Android-isms to boot, so still likely requires to reinvent a lot of the wheel to actually use it for most desktop programs.

Even the use of C++ is likely to frown many people. (Not me).


That is a java version of a class from libbinder. Having Java and native versions of classes is a common pattern for things meant to be used from both.

https://cs.android.com/android/platform/superproject/main/+/...


No, it is not. It is the Java class which has native methods that call into the C++ version, as someone said above. But it is still primarily a Java class.

dbus-java exists, does that magically turn dbus into being primarily implemented in Java?

No, of course not, that'd be absurd. Same thing with Parcel & Binder. Java bindings existing does not change the simple fact that binder itself does not have any Java in it. It's regularly used in processes with zero Java at all, this isn't a hypothetical it's a basic reality. That's why binder is used for HALs and similar low-level systems.


> dbus-java exists, does that magically turn dbus into being primarily implemented in Java?

it does if the only other implementation is basically the JNI native methods of dbus-java. This is what libbinder_ndk looks like from the outside. If there's a newer libbinder that does not look like a Java mess , I have not yet seen it.

Not negating that it may exist; the libbinder you quoted above looks similar to openbinder but I have never used it.


The C++ origin of Binder is annoying, but unlike original Binder[1] easily workable around especially given the exact format of messages is left up for implementation to decide outside few standard bits

[1] BeOS, the docs still match what is in Android :D


Not entirely , you need to agree on some constraints for wire protocol since the kernel ends up doing reference counting on objects sent through it.

That was in the "few standard bits", yes.

Just use Android's implementation

Isn't that tightly tied to the Android permission and app model, which is radically different from generic Linux.

Hopefully some distro will implement Android's permission on desktop then. Unix permissions were made for a time where we actually had multiple persons running software in the same OS (a use case that today is served by VMs) rather than protecting an app from another app run by the same user. https://xkcd.com/1200/

Which OS? I didn’t get many results for BSD binder. Then I figured maybe you were joking about the “serious” part, so I tried windows binder, iOS binder, didn’t see much…


Including drivers, as since Project Treble, starting with Android 8 all new drivers are required to be userspace, talking with the kernel via Android IPC (aka Binder).

Traditional Linux drivers are considered legacy in Android.


Well the userspace part of the driver. If they were only userspace they couldn't actually use the hardware. They have to have to be part of Linux or a kernel module to be able to talk to the hardware.


Binder will come to linux desktop soon... together with Android :)

Is there any plans by some DE to replace D-bus with Binder?

Is Binder better than D-Bus? How so?

1. Better devex. The toolchain for binder properly checks that you are writing and reading transactions correctly and if you don't you get a compile time error. Meanwhile using dbus you can call things wrong and it will still compile.

2. Better latency. When you send a Binder transaction to another process Linux will immediately schedule the binder thread of the other process, unless it's a oneway transaction that does not block executon. Then once the other process replies, the original process is immediately rescheduled. Dbus does not affect Linux's scheduling of processes. When you send a dbus message any other process can be scheduled and run instead of the bus. And then anything can run in-between the bus sending the message to the target process.

3. Having the message go through the bus also results in extra copying. Not just cheap copying of memory. Since it's through a UNIX socket it has to use extra system calls to read out of and into another socket. As opposed to binder where it's able to simply copy the memory of the parcel from one process to another.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: