Wandering Thoughts archives


Coming to terms with D-Bus

Thinking back, I probably first encountered DBus as a new magic part of Gnome. I didn't really give it any attention then or in fact for a long time afterwards and when I did start to pay some attention it was with a degree of old-Unix grumpyness. From my vague brushes with it, DBus certainly felt like yet another overcomplicated solution to everything spawned by a big GUI desktop. Like many people I've felt a certain amount of unease as DBus wormed its way deeper and deeper into the heart of my systems (which it clearly has; it's even running on our servers).

I won't say that I've come to love DBus yet. What I have come around to is a somewhat less grumpy view of it. Put simply, DBus is a solution to Unix's IPC problem, namely the lack of standard higher level IPC. It seems to be that these problems tend to surface most clearly in desktops, but any program that does IPC needs to define its message formats, have some way to be found by things that want to talk to it, and possibly worry about security. The traditional Unix way has been for everything to (re)invent its own way of doing all of this but that involves a lot of duplication of effort (and makes it hard to talk to programs except with the program's own custom tools). D-Bus is an attempt to implement all of the additional levels of IPC once so that we can be done with it.

In the sense of mathematical system minimalism, D-Bus isn't necessary. More exactly, all of the things that D-Bus is used for at the system level could define their own protocols and provide their own tools. You would have one program (and a private protocol) for talking to init, another system for the hotplug manager to notify other programs about new hardware, and so on and so forth. That is in fact the old Unix way and frankly it was a mess. A theoretically minimal mess, but still a mess.

With D-Bus you accept a certain amount of overkill for some jobs in the interests of not reinventing wheels over and over again and instead using a common set of infrastructure. D-Bus provides all the higher levels of IPC, both 'point to point' direct communication and a message bus; all you have to do is plug programs in to it and perhaps write some configuration files to define permissions. In this sense it really is necessary and thus I've come around to accepting it even if I don't exactly love it.

(I don't think that D-Bus is necessarily Unixy but then I don't think we yet know how to build a Unixy version of the higher levels of IPC. To the extent that we have an idea of how to do a Unixy message bus, I think it requires much better support for virtual filesystems than Linux has now. And the closest we have to a Unixy common message format is JSON.)

linux/AcceptingDBus written at 01:18:06; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.