Jump to content

D-Bus

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 218.103.114.193 (talk) at 04:37, 15 September 2015 (→‎Implementations: controversial, but not "unusually controversial".. The cited article said nothing about "unusual".). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

D-Bus
Developer(s)Red Hat and the community
Stable release
1.10.0[1] / August 25, 2015; 8 years ago (2015-08-25)
Repository
Written inC
Operating systemCross-platform
Type
LicenseGNU GPL version 2 or later, or AFL 2.1[2]
Websitewww.freedesktop.org/wiki/Software/dbus

D-Bus is an inter-process communication (IPC) and remote procedure call (RPC) mechanism that allows communication between multiple computer programs (that is, processes) concurrently running on the same machine.[3] D-Bus was designed as part of the effort of the freedesktop.org project to standardize services provided by Linux desktop environments such as GNOME and KDE.

The freedesktop.org project also developed a free and open-source software library called libdbus, as a reference implementation of the specification. This library is often confused with the D-Bus itself. Other implementations of D-Bus also exist, such as GDBus (GNOME),[4] QtDBus (Qt/KDE),[5] dbus-java[6] and sd-bus (part of systemd).[7]

Overview

D-Bus provides means for the communication between desktop applications in the same desktop session, which allows integration of the desktop session as a whole, and addresses issues of the process lifecycle. It also allows communication between the desktop session and the operating system, which typically includes the kernel and any system daemons or processes.

D-Bus is a message bus system, or a medium for interprocess communication that allows the applications to communicate and exchange messages between themselves. Thus, D-Bus provides additional or simplifies existing functionality to the applications, including information sharing, modularity and privilege separation. For example, information on an incoming voice call received through Bluetooth or Skype can be propagated and interpreted by any currently running music player, which can react by muting the volume or pausing playback until the call is finished.[8]

Most systems implement a privileged system channel, together with a private channel for each logged-in user, so that available information in the D-Bus registry can be restricted. Accordingly, the D-Bus service includes both a system daemon (for events such as "new hardware device added" or "printer queue changed") and a distinct daemon for each user login session (for general inter-process communication needs between applications started by the particular user). Applications communicate with daemons over Unix domain sockets. The message bus is built on top of a general one-to-one message passing framework, which any two applications can also use to communicate directly and without going through the message bus daemon.[9]

Internals

The dbus-daemon plays a significant role in modern Linux graphical desktop environments. Binder, also depicted above, is its counterpart used on Android.

D-Bus has three architectural layers:[8]

  • libdbus - a library that allows two applications to connect to each other and exchange messages
  • dbus-daemon - a message-bus daemon executable, built on libdbus, that multiple applications can connect to. The daemon can route messages from one application to zero or more applications, thereby implementing the publish/subscribe paradigm.
  • wrapper libraries based on particular application frameworks

Messages received over a D-Bus connection get routed to a specific object, not to a process. It thus appears to clients as if they are interacting with an object whether or not there actually is an object on the other side.

D-Bus defines a name for each object which looks like (but is not actually) a POSIX filesystem path, e.g., /org/kde/kspread/sheets/3/cells/4/5. D-Bus objects' names are conventionally namespaced to help with independently developing code modules.[10] Namespaces are generally prefixed with the developer's reserved domain name components (e.g. /org/kde).

Adoption

Heavily influenced by the DCOP system used by versions 2 and 3 of KDE, D-Bus has replaced DCOP in the KDE 4 release. An implementation of D-Bus supports most POSIX operating systems, and a port for Windows exists. It is used by Qt 4 and GNOME. In GNOME it has gradually replaced most parts of the earlier Bonobo mechanism. It is also used by Xfce.

The usage of D-Bus is steadily expanding beyond the initial scope of desktop environments to cover an increasing amount of system services. For instance, NetworkManager network daemon, BlueZ bluetooth stack and Pulseaudio sound server use D-Bus to provide part or all of its services, and systemd is promoting traditional system daemons to D-Bus services, such as logind.[citation needed]

It is also used as the Wire protocol for the AllJoyn protocol for home automation, to this end AllJoyn adds discovery, session management, security, header compression, embedded device support and makes it transport agnostic.[11]

Implementations

libdbus
Although there are several implementations of D-Bus, the most widely used is the reference implementation libdbus, developed by the same freedesktop.org project that designed the specification. However, libdbus is a low-level implementation that was never meant to be used directly by application developers, but as a reference guide for other reimplementations of D-Bus (such as those included in standard libraries of desktop environments, or in programming language bindings). The freedesktop.org project itself recommends applications authors to "use one of the higher level bindings or implementations" instead.[12]
The predominance of libdbus as the most used D-Bus implementation caused the terms "D-Bus" and "libdbus" to be often used interchangeably, leading to confusion.
GDBus
GDBus[4] is an implementation of D-Bus based on GIO streams included in GLib, aiming to be used by GTK+ and GNOME. GDBus is not a wrapper of libdbus, but a complete and independent reimplementation of the D-Bus specification and protocol.[13]
QtDBus
QtDBus[5] is an implementation of D-Bus included in the Qt library since its version 4.2. This component is used by KDE applications, libraries and components to access the D-Bus services available in a system.
sd-bus
In 2013, the systemd project rewrote libdbus in an effort to simplify the code,[14] but it also resulted in a significant increase of the overall D-Bus performance. In preliminary benchmarks, BMW found that the systemd's D-Bus library increased performance by 360%.[15] As of version 221 of systemd, the sd-bus API has been declared stable.[16]
kdbus
There is an ongoing development project called kdbus that aims to reimplement D-Bus as a kernel-mediated peer-to-peer inter-process communication mechanism. Beside performance improvements, kdbus would have advantages arising from already existing Linux kernel features such as namespaces and auditing,[17][18] security from the kernel mediating, closing race conditions, and allowing D-Bus to be used during boot and shutdown (as needed by systemd).[19] kdbus inclusion in the Linux kernel has proven controversial,[20] and As of September 2015 has not been merged yet.
Language bindings
Several programming language bindings for D-Bus has been developed,[21] such as those for Java, C# and Ruby.

See also

References

  1. ^ "Announcing D-Bus 1.10.0 (new stable branch)". 2015-08-25. Retrieved 2015-08-25.
  2. ^ Havoc's Blog July, 2007
  3. ^ Cocagne, Tom. "DBus Overview". pythonhosted.org. Retrieved 23 May 2015.
  4. ^ a b "gdbus". GNOME developer. GNOME project. Retrieved 4 January 2015.
  5. ^ a b "QtDBus module". Qt Project. Qt Project. Retrieved 1 June 2015.
  6. ^ "DBus-Java Documentation". FreeDesktop.org. Retrieved 4 January 2015.
  7. ^ "The new sd-bus API of systemd". 19 June 2015. Retrieved 20 June 2015.
  8. ^ a b Robert Love (2005-01-05). "Get on the D-BUS". Linux Journal. Retrieved 2014-10-14. {{cite web}}: Italic or bold markup not allowed in: |publisher= (help)
  9. ^ "dbus: What is D-Bus?". freedesktop.org. 2014-01-20. Retrieved 2014-10-14.
  10. ^ "D-Bus Tutorial".
  11. ^ https://allseenalliance.org/developer-resources/forum/developers/difference-d-bus
  12. ^ "What is D-Bus?". FreeDesktop.org. Retrieved 5 January 2015. "It should be noted that the low-level implementation is not primarily designed for application authors to use. Rather, it is a basis for binding authors and a reference for reimplementations. If you are able to do so it is recommended that you use one of the higher level bindings or implementations."
  13. ^ "Migrating to GDBus". GNOME Developer. Retrieved 16 June 2015. "dbus-glib uses the libdbus reference implementation, GDBus doesn't. Instead, it relies on GIO streams as transport layer, and has its own implementation for the D-Bus connection setup and authentication."
  14. ^ Poettering, Lennart. "libsystemd-bus + kdbus plans". systemd-devel mailing list. Retrieved 24 April 2015.
  15. ^ "ALS: Linux inter-process communication and kdbus". LWN.net. 2013-05-30. Retrieved 2013-11-13.
  16. ^ "[systemd-devel] [ANNOUNCE] systemd v221". freedesktop.org. 2015-06-19. Retrieved 2015-06-20.
  17. ^ Jake Edge (2013-05-30). "ALS: Linux interprocess communication and kdbus". LWN.net. Retrieved 2014-04-11.
  18. ^ Jonathan Corbet (2014-01-13). "The unveiling of kdbus". LWN.net. Retrieved 2014-04-11.
  19. ^ http://lkml.iu.edu/hypermail/linux/kernel/1504.1/03936.html
  20. ^ Corbet, Jonathan. "The kdbuswreck". LWN.Net. Retrieved 29 June 2015.
  21. ^ "D-Bus Bindings". FreeDesktop.org. Retrieved 5 January 2015.

{{IPC athlete}} template missing ID and not present in Wikidata.