pages tagged messageyakkinghttp://yakking.branchable.com/tags/message/yakkingikiwiki2015-12-02T12:00:12ZD-Bushttp://yakking.branchable.com/posts/dbus/Richard Maw2015-12-02T12:00:12Z2015-12-02T12:00:07Z
<p><a href="http://www.freedesktop.org/wiki/Software/dbus/">D-Bus</a> is an <a href="https://en.wikipedia.org/wiki/IPC">IPC</a> mechanism designed for applications and services,
with the aim of providing:</p>
<ol>
<li>Reliability of message delivery.</li>
<li>Globally consistent message ordering.</li>
<li>Providing broadcast notifications of changes.</li>
<li>If you're using <a href="http://www.freedesktop.org/wiki/Software/systemd/kdbus/">kdbus</a>, trust of the identity of the message sender.</li>
</ol>
<p><a href="http://www.freedesktop.org/wiki/Software/dbus/">D-Bus</a> is not designed for:</p>
<ol>
<li><p>Bulk transport of data:</p>
<p>For that you may want to use a <a href="http://man7.org/linux/man-pages/man7/pipe.7.html">pipe</a> or regular file descriptor.</p></li>
<li><p>Turning Linux into a <a href="http://man7.org/linux/man-pages/man7/pipe.7.html">microkernel</a>.</p>
<p>Microkernels are known for having very fast <a href="https://en.wikipedia.org/wiki/IPC">IPC</a>,
and do every operation by sending a message to some other component.</p>
<p>It is tempting to build microkernel semantics on top of Linux
by having services react to messages and perform the required actions,
rather than using system calls.</p>
<p>The overhead involved in using <a href="http://www.freedesktop.org/wiki/Software/dbus/">D-Bus</a> is too great for this.</p></li>
</ol>
<p>At its core, <a href="http://www.freedesktop.org/wiki/Software/dbus/">D-Bus</a> is a <a href="http://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageBus.html">message bus</a>,
with subscription semantics so you get event notifications,
and a <a href="https://en.wikipedia.org/wiki/Marshalling_(computer_science)">serialisation/marshalling</a> mechanism
to provide a <a href="https://en.wikipedia.org/wiki/Type_system">type system</a> for messages.</p>
<p>Built on top of this is an <a href="https://en.wikipedia.org/wiki/Object_model">object model</a>,
where applications sit in an event loop,
responding to messages to call methods or read properties of virtual objects,
in the <a href="https://en.wikipedia.org/wiki/Object-oriented_programming">object oriented</a> sense.</p>
<p>Application frameworks often build on top of this to provide proxy objects,
so that you can effectively refer to objects in different processes.</p>
<p>By providing a well known name where a <a href="http://www.freedesktop.org/wiki/Software/dbus/">D-Bus</a> object may be found,
you can have local services provide an API for performing operations,
and local applications instruct these services to perform operations.</p>
<p>A more detailed description of what <a href="http://www.freedesktop.org/wiki/Software/dbus/">D-Bus</a> is and its concepts,
can be found <a href="http://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html">here</a>.
The article is about <code>sd-bus</code>, but the "What is D-Bus again?" and
"Introduction to D-Bus Concepts" sections are relevant to understanding D-Bus.</p>