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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

An alternative to shared libraries (2008)

34 点作者 entelechy将近 7 年前

6 条评论

dagenix将近 7 年前
&gt; I like static linking. But code these days is getting extremely complex and bloated, so people needed an alternative. Instead of focusing on making their code more cleaner and lean, they started thinking about they can share this huge piece of complex and bloated code across several applications. If you think about it, if your code is small and clean, you wouldn’t feel the need for shared libraries.<p>One person&#x27;s &quot;bloat&quot; is another person&#x27;s &quot;critical feature&quot;. When I see this word thrown around, I&#x27;m always left worried about what is going to come next. And then the author proposes avoiding shared libraries in favor of what sounds like a single-system microservices model. Such a model doesn&#x27;t resolve any of the versioning issues of shared libraries but does add in all of the issues faced by a distributed systems combined with dramatically higher invocation overhead.<p>The stuff about plan 9 is interesting - but I&#x27;m left wondering why exactly this is being reposted now.
_bxg1将近 7 年前
I&#x27;ve done mercifully-little C(++) programming in my life, but the very idea of dll&#x27;s has always seemed extremely fragile to me. Depending that deeply on the system configuration for basic functioning... ylech.<p>I also can&#x27;t help but wonder if they&#x27;re obsolete these days, given how incredibly cheap disk storage is? Can anyone who works in that sector speak more to that?
评论 #17396938 未加载
评论 #17396548 未加载
theamk将近 7 年前
So an alternative to shared libraries is RPC over FUSE-like transport?<p>It is a sane idea and may work well, but I think the page overcomplicates it. Why bother with filesystem -- having cryptofs implement &quot;getattr&quot; and &quot;readlink&quot; seems like a total waste. Why not use the things <i>designed</i> for RPC?<p>For example, one may use raw unix sockets (this is how Xorg, and pulseaudio work), or D-Bus (this is how disk mounting in modern desktop linux works), or HTTP-based transports (this will be known as &quot;microservices&quot; then).
评论 #17397988 未加载
ridiculous_fish将近 7 年前
This proposal is crazy town.<p><i>If you think about it, if your code is small and clean, you wouldn’t feel the need for shared libraries.</i><p>Not so. The key feature of DLLs is to enable software components to evolve independently. When Apple changes the way a button looks in UIKit, all apps get the updated behavior, because UIKit is dynamically linked. This has nothing to do with the app size or its hygeine.<p>Replacing dylib calls with filesystems and fread&#x2F;fwrite is absurd. IPC is much harder than library calls. There&#x27;s the obvious expense of turning every library call into multiple system calls. It&#x27;s also less flexible. When the interface is a function call, the function can switch implementations from eager to lazy, add or remove caches, etc. But when your interface is fread() you must provide your data up front. Switching a field to computed on-demand is a breaking change.<p>But the versioning issues are the worst. Reading from Plan9 &#x2F;dev&#x2F;mouse returns 49 bytes. I can&#x27;t add a new field without breaking apps. The equivalent of adding a method in an OO language is now a <i>breaking file format change</i> in this scheme. The post attempts to addresses this:<p><i>With filesystems, it’s trivial to add functionality without breaking applications depending on older versions of your FS. That’s because all the compiler sees is a bunch of fopen&#x2F;fread&#x2F;fwrites and is not going to complain if the version of the filesystem changes because it doesn’t know.</i><p>The app can&#x27;t break because the compiler can&#x27;t detect the breakage. Huh?<p><i>Alternatively, if you’re thinking of modifying the behavior of your filesystem; consider providing a version file in the root of your FS right from the beginning. Applications would then write the version number they expect to be working with in that file as a way of initializing the filesystem</i><p>This sounds very bad:<p>1. Every API needs to be able to ingest and emit all past versions of themselves, in perpetuity. This is obviously a huge maintenance burden.<p>2. This does nothing about the reverse problem: how does an app run on multiple versions of the OS? Instead of, say, using reflection to test if a method is present, apps must be prepared to parse the product of every API they use against every OS version they want to support.<p>3. Applications do not have a single &quot;version number they expect.&quot; Apps are built out of multiple components written at different times which consume different versions of the same API. There&#x27;s no affordance for that.<p>So we&#x27;re forced to use some structured data format with named fields, rather than raw bytes. How did this come out of a desire for a &quot;lean, efficient and small&quot; solution?
评论 #17399081 未加载
Iwan-Zotow将近 7 年前
And where, f.e., SO&#x2F;DLL allocated memory supposed to live? In SO only text segment is marked ro and mapped shared between many processes. Data (whether is it .data or malloced) is in the particular process memory and is NOT shared
axaxs将近 7 年前
As Docker has proved to me, people don&#x27;t care about saving space anymore. The time of shared libraries has come and gone. And yes I realize you can use shared libraries in Docker, but at that point it&#x27;s acting more like a static library oddly enough.<p>Side note - anytime I see Drepper mentioned I cringe a bit. I don&#x27;t like to badmouth people, but I can&#x27;t think of a worse figure in recent open source history.