TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Rethinking the D-Bus Message Bus

253 pointsby kragnizover 7 years ago

12 comments

Animatsover 7 years ago
<i>We rather consider a bus a set of distinct peers with no global state.</i><p>If they&#x27;ve gone that far, they may as well implement QNX messaging, which is known to work well. QNX has an entire POSIX implementation based on QNX&#x27;s messaging system, so it&#x27;s known to work. Plus it does hard real time.<p>The basic primitives work like a subroutine call. There&#x27;s MsgSend (send and wait for reply), MsgReceive (wait for a request), and MsgReply (reply to a request). There&#x27;s also MsgSendPulse (send a message, no reply, no wait) but it&#x27;s seldom used. Messages are just arrays of bytes; the messaging system has no interest in content. Receivers can tell the process ID of the sender, so they can do security checks. All I&#x2F;O is done through this mechanism; when you call &quot;write()&quot;, the library does a MsgSend.<p>Services can give their endpoint a pathname, so callers can find them.<p>The call&#x2F;reply approach makes the hard cases work right. If the receiver isn&#x27;t there or has exited, the sender gets an error return. There&#x27;s a timeout mechanism for sending; in QNX, anything that blocks can have a timeout. If a sender exits while waiting for a reply, that doesn&#x27;t hurt the receiver. So the &quot;cancellation&quot; problem is solved. If you wan to do something else in a process while waiting for a reply, you can use more threads in the sender. On the receive side, you can have multiple threads taking requests via MsgReceive, handling the requests, and replying via MsgReply, so the system scales.<p>CPU scheduling is integrated with messaging. On a MsgSend, CPU control is usually transferred from sender to receiver immediately, without a pass through the scheduler. The sending thread blocks and the receiving thread unblocks.<p>With unidirectional messaging (Mach, etc.) and async systems, it&#x27;s usually necessary to build some protocol on top of messaging to handle errors. It&#x27;s easy to get stall situations. (&quot;He didn&#x27;t call back! He said he&#x27;d call back! He promised he&#x27;d call back!&quot;) There&#x27;s also a scheduling problem - A sends to B but doesn&#x27;t block, B unblocks, A waits on a pipe&#x2F;queue for B and blocks, B sends to A and doesn&#x27;t block, A unblocks. This usually results in several trips through the scheduler and bad scheduling behavior when there&#x27;s heavy traffic.<p>There&#x27;s years (decades, even) of success behind QNX messaging, yet people keep re-inventing the wheel and coming up with inferior designs.
评论 #15083707 未加载
评论 #15083746 未加载
评论 #15087114 未加载
评论 #15085565 未加载
评论 #15086743 未加载
评论 #15086575 未加载
评论 #15090457 未加载
评论 #15088999 未加载
评论 #15083919 未加载
onliover 7 years ago
That sounds reasonable. I&#x27;m very surprised. Disabling remote targets, ignoring SELinux, focusing on reliability.<p>DBus is the one part of the modern linux desktop I would like to&#x2F;have to install to get the applications I want running, even though I dislike it a lot (pulseaudio and systemd one can just not install). One example is the password remember function of steam. Having a more reasonable implementation could help with this a lot.
评论 #15081662 未加载
评论 #15082002 未加载
atemerevover 7 years ago
Dbus is bloated hell. Whoever came with the idea &quot;let&#x27;s cram all communications from all sources into the single unified data stream, and let the clients fish what they need out of it&quot; had the strange mapping of mental processes, to say the least. Most other forms of IPC are better (more scalable, more elegant, more comprehensible) — &quot;everything is a file&quot; is better, actor model is better, and I nearly think that even plain shared memory is better than a common bus.<p>There is a reason there is no &quot;shared bus&quot; in Internet communications.
评论 #15083538 未加载
评论 #15083698 未加载
评论 #15082105 未加载
评论 #15082147 未加载
评论 #15083626 未加载
arca_voragoover 7 years ago
&quot;Linux Only&quot;<p>I like this approach more and more these days. For example, I run murmur(mumble) servers sometimes, and they deprecated d-bus support for ZeroC ICE (gplv2 or proprietary), but it seems almost as bloated if not more so. The reasoning was mostly around the portability bindings...<p>Recently though, I have been refusing to support Windows and OSX as a concious decision. One thing I&#x27;ve found is that the constant want&#x2F;need to target every platform adds an ever-increasing amount of complexity, which really seems to go against the unix philosophy. So I applaud others willing to buck the trend and narrow scope down.<p>In the end, I think the main problem with the many eyes theory is that code has gotten so complex that there simply aren&#x27;t enough eyes, and therefore I think the future of software is going to be in reduction of complexity. For example, loc isn&#x27;t the best measure, but the Minix 3 kernel is at ~20kloc, while the Linux kernel is now at, what ~11mloc!? Not even redhat can audit that shit properly. (another reason we need a Hurd microkernel, but I digress)
评论 #15083667 未加载
评论 #15087216 未加载
评论 #15084094 未加载
zokierover 7 years ago
Just noticed that this lives under bus1 github organization; does that imply that eventually it will be using bus1?<p>Btw, whats happening at bus1, haven&#x27;t heard about it lately?
评论 #15082146 未加载
评论 #15085326 未加载
baybal2over 7 years ago
As I remember from more than a decade ago, the selling point of DBUS was that they were not trying to design a high performance message bus with sophisticated work mechanisms in spirit of Corba and Bonobo, but a small, flexible, and utilitarian one.<p>Things like implicit message buffering were deliberate design decisions.
评论 #15081829 未加载
评论 #15081717 未加载
revelationover 7 years ago
Ahh yes, we know this all too well, the Linux desktop trap:<p>iterative work is lame, the old solution is so bad it&#x27;s not even wrong, here is my idea for a rewrite, look it&#x27;s even still compatible (for another few minutes).
评论 #15083237 未加载
评论 #15084626 未加载
chmeover 7 years ago
So is the dbus-broker the latest project from the kdbus&#x2F;bus1 guys.<p>Since from the text dbus-broker does not use the bus1 kernel module, does that mean the bus1 project is dead?
评论 #15082133 未加载
throw7over 7 years ago
are you still required to reboot the system if you upgrade &quot;dbus-broker&quot;?
评论 #15081858 未加载
JdeBPover 7 years ago
One thing that I wonder about this is how it deals with the D-Bus Death Rattle.<p>* <a href="https:&#x2F;&#x2F;jdebp.eu&#x2F;FGA&#x2F;dbus-death-rattle.html" rel="nofollow">https:&#x2F;&#x2F;jdebp.eu&#x2F;FGA&#x2F;dbus-death-rattle.html</a>
评论 #15089591 未加载
j_sover 7 years ago
I&#x27;m sure systemd would be happy to take over responsibility for this functionality. (Sorry, couldn&#x27;t resist!)
评论 #15107113 未加载
评论 #15081763 未加载
digi_owlover 7 years ago
And i see the PR team is already out in force to sell this and defend what has already been sold.<p>We should really just move to BSD already and let them sink this ship.