D-Bus
Encyclopedia
In computing
, D-Bus (Desktop Bus) is a simple inter-process communication
(IPC) open-source system for software applications to communicate with one another. Heavily influenced by KDE
2–3's DCOP
system, 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.
Red Hat
operates as the primary developer of D-Bus as part of the freedesktop.org
project.
hardware.
D-Bus functionality runs as a daemon
: typically
The purpose of the private channel is to provide unrestricted communication among any applications of the user.
Currently, D-Bus works over Unix sockets, but work is being done to create a 'peer-to-peer' socket in the Linux kernel able to route messages between applications, leaving the daemon as a top-level manager. The main advantage of this new approach is that it improves speed by halving the number of memory-copy operations.
The design of D-Bus addresses two specific cases:
that usually map to GObject
, QObject, C++
objects, or Python
objects. Each D-bus object operates as an instance rather than as a type. Messages received over a D-Bus connection get routed to a specific object, not to the application as a whole. In this way, D-Bus resembles software componentry, as it appears to users as if they are interacting with an object
across the IPC connection, whether or not there is an object on the other side.
To allow messages to specify their destination object, the system needs a way to refer to an object. Many programming languages refer to this as a pointer or reference. However, these references are implemented as memory addresses relative to the address space of the application, and thus can't be passed from one application to another.
To solve this, D-Bus introduces a name for each object. The name looks like a filesystem path, for example an object could have the name /org/kde/kspread/sheets/3/cells/4/5. D-Bus encourages human-readable
paths, but developers are free to create an object named /com/mycompany/c5yo817y0c1y1c5b if it makes sense for their application.
The D-Bus objects' names are namespaced
to keep different code modules separated. Namespaces are generally prefixed with the developer's reversed domain name
components (e.g. /org/kde).
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
, D-Bus (Desktop Bus) is a simple inter-process communication
Inter-process communication
In computing, Inter-process communication is a set of methods for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC methods are divided into methods for message passing, synchronization, shared...
(IPC) open-source system for software applications to communicate with one another. Heavily influenced by KDE
KDE
KDE is an international free software community producing an integrated set of cross-platform applications designed to run on Linux, FreeBSD, Microsoft Windows, Solaris and Mac OS X systems...
2–3's DCOP
DCOP
DCOP, which stands for Desktop COmmunication Protocol, is a light-weight interprocess and software componentry communication system. The main point of this system is to allow applications to interoperate, and to share complex tasks...
system, D-Bus has replaced DCOP in the KDE 4 release. An implementation of D-Bus supports most POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...
operating systems, and a port for Windows exists. It is used by Qt
Qt (toolkit)
Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface , and also used for developing non-GUI programs such as command-line tools and consoles for servers...
4 and GNOME
GNOME
GNOME is a desktop environment and graphical user interface that runs on top of a computer operating system. It is composed entirely of free and open source software...
. In GNOME it has gradually replaced most parts of the earlier Bonobo mechanism.
Red Hat
Red Hat
Red Hat, Inc. is an S&P 500 company in the free and open source software sector, and a major Linux distribution vendor. Founded in 1993, Red Hat has its corporate headquarters in Raleigh, North Carolina with satellite offices worldwide....
operates as the primary developer of D-Bus as part of the freedesktop.org
Freedesktop.org
freedesktop.org is a project to work on interoperability and shared base technology for free software desktop environments for the X Window System on Linux and other Unix-like operating systems. It was founded by Havoc Pennington from Red Hat in March 2000.The organisation focuses on the user....
project.
Design
D-Bus allows programs to register with it in order to offer services. It also allows client programs to check for the availability of services. Programs can also register as waiting for events of the kernel, as in the case of hot-swappingHot swapping
Hot swapping and hot plugging are terms used to describe the functions of replacing computer system components without shutting down the system...
hardware.
D-Bus functionality runs as a daemon
Daemon (computer software)
In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...
: typically
dbus-daemon
. Users can run several instances of it, each called a channel. Most systems implement a privileged system channel, plus a private channel for each logged-in user. The private channels are required because the system channel has access restrictions.The purpose of the private channel is to provide unrestricted communication among any applications of the user.
Currently, D-Bus works over Unix sockets, but work is being done to create a 'peer-to-peer' socket in the Linux kernel able to route messages between applications, leaving the daemon as a top-level manager. The main advantage of this new approach is that it improves speed by halving the number of memory-copy operations.
Architecture
D-Bus has three architectural layers:-
libdbus
- a library that allows two applications to connect to each other and exchange messages -
dbus-daemon
- a message-bus daemon executable, built onlibdbus
, 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
The design of D-Bus addresses two specific cases:
- communication between desktopDesktop environmentIn graphical computing, a desktop environment commonly refers to a style of graphical user interface derived from the desktop metaphor that is seen on most modern personal computers. These GUIs help the user in easily accessing, configuring, and modifying many important and frequently accessed...
applicationsApplication softwareApplication software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...
in the same desktop session; to allow integration of the desktop session as a whole, and address issues of process lifecycle - communication between the desktop session and the operating systemOperating systemAn operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
, where the operating system would typically include the kernel and any system daemonsDaemon (computer software)In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user...
or processes
Mechanisms
Each application using D-Bus contains objectsObject (computer science)
In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure...
that usually map to GObject
GObject
The GLib Object System, or GObject, is a free software library providing a portable object system and transparent cross-language interoperability...
, QObject, C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
objects, or Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...
objects. Each D-bus object operates as an instance rather than as a type. Messages received over a D-Bus connection get routed to a specific object, not to the application as a whole. In this way, D-Bus resembles software componentry, as it appears to users as if they are interacting with an object
Remote procedure call
In computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...
across the IPC connection, whether or not there is an object on the other side.
To allow messages to specify their destination object, the system needs a way to refer to an object. Many programming languages refer to this as a pointer or reference. However, these references are implemented as memory addresses relative to the address space of the application, and thus can't be passed from one application to another.
To solve this, D-Bus introduces a name for each object. The name looks like a filesystem path, for example an object could have the name /org/kde/kspread/sheets/3/cells/4/5. D-Bus encourages human-readable
Human-readable
A human-readable medium or human-readable format is a representation of data or information that can be naturally read by humans.In computing, human-readable data is often encoded as ASCII or Unicode text, rather than presented in a binary representation...
paths, but developers are free to create an object named /com/mycompany/c5yo817y0c1y1c5b if it makes sense for their application.
The D-Bus objects' names are namespaced
Namespace (computer science)
A namespace is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols . An identifier defined in a namespace is associated only with that namespace. The same identifier can be independently defined in multiple namespaces...
to keep different code modules separated. Namespaces are generally prefixed with the developer's reversed domain name
Domain name
A domain name is an identification string that defines a realm of administrative autonomy, authority, or control in the Internet. Domain names are formed by the rules and procedures of the Domain Name System ....
components (e.g. /org/kde).
See also
- Remote procedure callRemote procedure callIn computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...
- CORBAÇorbaChorba , ciorbă , shurpa , shorpo , or sorpa is one of various kinds of soup or stew found in national cuisines across Middle East...
Common Object Request Broker Architecture, cross language cross platform object model - GNOMEGNOMEGNOME is a desktop environment and graphical user interface that runs on top of a computer operating system. It is composed entirely of free and open source software...
BonoboBonobo (computing)Bonobo is a component model for creating reusable software components and compound documents. It was created by the company Ximian for compound documents used in GNOME....
deprecated GNOME cross language Object Model - KDEKDEKDE is an international free software community producing an integrated set of cross-platform applications designed to run on Linux, FreeBSD, Microsoft Windows, Solaris and Mac OS X systems...
DCOPDCOPDCOP, which stands for Desktop COmmunication Protocol, is a light-weight interprocess and software componentry communication system. The main point of this system is to allow applications to interoperate, and to share complex tasks...
deprecated KDE interprocess and software componentry communication system - KDEKDEKDE is an international free software community producing an integrated set of cross-platform applications designed to run on Linux, FreeBSD, Microsoft Windows, Solaris and Mac OS X systems...
KPart KDE component framework - XPCOMXPCOMXPCOM is a cross-platform component model from Mozilla. It is similar to Microsoft COM and CORBA. It has multiple language bindings and IDL descriptions so programmers can plug their custom functionality into the framework and connect it with other components.-The model:XPCOM is one of the main...
Mozilla applications cross Platform Component Object Model - COMComponent Object ModelComponent Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...
Microsoft Windows only cross language Object Model - DCOMDistributed component object modelDistributed Component Object Model is a proprietary Microsoft technology for communication among software components distributed across networked computers. DCOM, which originally was called "Network OLE", extends Microsoft's COM, and provides the communication substrate under Microsoft's COM+...
Distributed COM, extension making COM able to work in networks - Common Language InfrastructureCommon Language InfrastructureThe Common Language Infrastructure is an open specification developed by Microsoft and standardized by ISO and ECMA that describes the executable code and runtime environment that form the core of the Microsoft .NET Framework and the free and open source implementations Mono and Portable.NET...
current .Net cross language cross platform Object Model - Java Remote Method InvocationJava remote method invocationThe Java Remote Method Invocation Application Programming Interface , or Java RMI, is a Java application programming interface that performs the object-oriented equivalent of remote procedure calls ....
(Java RMI) - Foreign function interfaceForeign function interfaceA foreign function interface is a mechanism by which a program written in one programming language can call routines or make use of services written in another. The term comes from the specification for Common Lisp, which explicitly refers to the language features for inter-language calls as...
External links
- D-Bus at the Freedesktop.org home page
- Introduction to D-Bus on the Freedesktop.org wiki