TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

DBus, FreeDesktop, and lots of madness

147 点作者 billiob超过 10 年前

12 条评论

captainmuon超过 10 年前
I really liked the &quot;predecessor&quot; DCOP better. Applications publish objects, others can call methods (one-shot) or functions (wait for response).<p>From DBUS&#x27; own (old) FAQ:<p>&gt; D-Bus is a bit more complex than DCOP, though the Qt binding for D-Bus should not be more complex for programmers. The additional complexity of D-Bus arises from its separation of object references vs. bus names vs. interfaces as distinct concepts, and its support for one-to-one connections in addition to connections over the bus. The libdbus reference implementation has a lot of API to support multiple bindings and main loops, and performs data validation and out-of-memory handling in order to support secure applications such as the systemwide bus.<p>&gt; D-Bus is probably somewhat slower than DCOP due to data validation and more &quot;layers&quot; in the reference implementation. A comparison hasn&#x27;t been posted to the list though.<p>IMHO DBus suffers from the kind of overengineering that&#x27;s been endemic in Desktop Linux in the last few years: DConf&#x2F;GSettings (as a less flexible, IMHO unneccessary replacement for GConf), PulseAudio and NetworkManager (initially really bad, now work nicely, as long as you don&#x27;t have to debug problems...), all the *Kit stuff, systemd, and so on. For me, libraries like this don&#x27;t really solve problems on average, but cause regressions.
评论 #8648750 未加载
评论 #8648741 未加载
评论 #8649195 未加载
评论 #8648669 未加载
Animats超过 10 年前
Somehow, attempts to bolt message passing onto Linux never seem to be very good. Probably because the primitives underneath are a poor match.<p>QNX, which is a real-time microkernel, got message passing more or less right. You connect to a port of another process. Then you send with MsgSend, which sends a message of N bytes, and waits for a reply. So it&#x27;s like a procedure call.<p>The receiving end (considered the server) does MsgReceive, which blocks waiting for work, gets the bytes, and returns a reply with MsgReply. That&#x27;s QNX messaging.<p>Everything goes through this, including all I&#x2F;O. It&#x27;s very fast, and integrated with the CPU scheduler, so most message passes just transfer control to the other end without scheduling delay. This allows rapid tossing of control back and forth between processes without going to the end of the line for CPU time.<p>Because QNX is a real-time OS, there are some additional features. Messages are ordered by thread priority, so real-time requests are serviced ahead of non-real time. (This works well enough that running a compile or a browser doesn&#x27;t impact hard deadline real-time work.) Any request can have a timeout, in case the other end has a problem. Finally, when a MsgSend from a high priority process goes to a lower-priority process, the receiving process gets the higher priority until the MsgReply, to avoid priority inversion.<p>Linux messaging almost always goes through unidirectional byte pipes of some sort. So you need a protocol just to figure out where the message boundaries are. D-Bus seems to be struggling with that. Building a call-like mechanism on top of unidirectional pipes means that callers do a write followed by a read. For a moment, between the write and the read, both sender and receiver are ready to run. This means a trip through the scheduler, or worse, starting the receiving process on a different CPU and suffering cache misses.<p>It&#x27;s one of those things where the wrong primitives at the bottom cascade into layers of complexity above.
评论 #8649418 未加载
newuser88273超过 10 年前
X11 was a great success because it was a protocol that you could write X servers and X clients and X window managers against.<p>Nobody wants to do that anymore. There are two major forces to blame.<p>First, open source. A well designed protocol is much more work, and you can avoid it by just pointing to the open source&#x27;d implementation, as this article (hilariously) shows for the case of DBUS.<p>The second force is the adware&#x2F;spyware model of web and app monetization. You don&#x27;t want people to use their own clients against a protocol (email, usenet, web 1.0) because you can&#x27;t serve ads as effectively and you can&#x27;t run analytics on their every mouseclick, touch gesture and keypress.<p>The whole systemd debacle would be much defused if systemd had been a couple of well thought-out and stable protocols, much like X11, instead of a big source-blob of underspecified and ever-shifting implementation.
评论 #8648862 未加载
评论 #8648731 未加载
评论 #8649239 未加载
drdaeman超过 10 年前
The protocol is ASCII-only, but strings are UTF-8, and then they talk about endianness?<p>That&#x27;s not a modern message bus, that&#x27;s a post-modern one.
评论 #8648708 未加载
quotemstr超过 10 年前
Under Windows, COM and RPC are a dream compared to this mess. Interfaces are clearly-defined, versioned entities that support transmitting arbitrarily complex values (even ones containing circular references!) over a variety of protocols. It&#x27;s also very fast: the &quot;ncalprc&quot; transport uses ALPC, which is the best IPC system I&#x27;ve seen on any platform. [1]<p>Using dbus, I feel like I have to type the same goddamn namespace name three or four times and that I never really feel like I&#x27;ve gotten it right.<p>Also, FOSS developers are in general completely obvious to interprocess race conditions. When you refer to something by an &quot;id&quot; and that &quot;id&quot; can be reused and recycles between subsequent calls, you&#x27;ve gotten it fundamentally wrong. I see developers make this mistake over and over in POSIXland.<p>[1] No, ALPC isn&#x27;t like RPC-specific like kdbus: it&#x27;s just a very, very good implementation of message passing over socket-like kernel handles.
评论 #8649704 未加载
评论 #8649783 未加载
评论 #8649584 未加载
bitwize超过 10 年前
Careful! If you accidentally discover what dbus is for and why it is here, Lennart will immediately deprecate it and replace it with something even more bizarre and inexplicable! And we&#x27;ll never interoperate and the year of the Linux desktop gets pushed back another decade or two...
评论 #8649319 未加载
digi_owl超过 10 年前
Find myself reminded of Joel going over the Excel file format specs after MS released them, and found off hand references like &quot;See Lotus 1-2-3 spec&quot; or something of that nature.
tux3超过 10 年前
That is actually really scary.<p>I tried reading about DBUS a couple of times before, but gave up before getting more than a high level overview.
teddyh超过 10 年前
So the documentation apparently sucks. OK, this is a bad sign, but can be fixed. Also, apparently the raw on-the-wire protocol is less than optimal. This is harder to change, but the implementation of kdbus has an excellent opportunity to fix this for itself and its associated client library.
评论 #8649116 未加载
voltagex_超过 10 年前
And this shit is being bolted on to the kernel?! At least the documentation might improve a bit...
评论 #8649027 未加载
评论 #8648582 未加载
guipsp超过 10 年前
&gt;So there seems to be some confusion what things like &quot;binary&quot; mean<p>I&#x27;m pretty sure binary, in this context just means you can&#x27;t open a payload in notepad.
评论 #8648723 未加载
general_failure超过 10 年前
In this day, I would just use http and websockets instead of dbus even for local communication. It just makes sense
评论 #8650453 未加载