All software sucks (2007) (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
Replies (3)
Replies (1)
- Size: shared libraries save some disk space. But disks are absurdly large these days compared to executable code, and in practice, code is never the thing that's going to fill up your disk. Your disk is going to be full of data, not code. (Or whichever hybrid of "code" and "data" you want to call a set of neural network weights...)
- Memory: shared libraries can theoretically have the same mapped code pages in memory across several processes. Marginally more interesting, but still not where most of your RAM is going today.
- Upgrades, maintenance, and build time: the expectation that if there's a bug in the shared library, you can update the shared library, and not need to update all the software built atop it. The most interesting reason that's still remaining, but not enough to put up with the tradeoffs of dynamic linking. You'd still have to restart all the applications that have that shared library loaded, so you don't get any logistical isolation there (whereas you would with components communicating via some RPC protocol). You may well have to rebuild things anyway, if the bug is in anything that gets inlined into the application. You have versioning problems, and all the clever schemes like symbol versioning are used by vanishingly few libraries (mostly glibc). And ultimately, rebuilding software isn't nearly as expensive as it used to be, because we have a lot more computing power now.
Dynamic linking seems like a tradeoff designed when the most interesting shared library on your system was libc. It imposes logistical and efficiency costs on everything. And it doesn't buy enough to be worth it.
If you want to have shared components that can be upgraded independently, have services communicating via RPC.
Replies (2)
As you said, logistical and efficiency costs.
Replies (1)
The most annoying tradeoff with that is you can't pass libc pointers across DLL boundaries. You can't malloc something in one DLL and free it in another. You either use an allocator from a known DLL (like LocalAlloc/LocalFree) or you give your DLL a wrapper call to free so you can free the things it returns.
Replies (1)
You shared a great example. A unified program loader allows multiple libc implementations. However, no single unified libc means no passing libc pointers across DLLs.
Everyone hates dynamic linking, but it's necessary. Modern versions like Apple's dyld shared cache avoid a lot of the problems (at the cost of centralization).
Replies (2)
I do definitely agree for dynamic linking though. It was mostly a disk space saving measure. If one insists it could be a compatibility feature too.
Replies (3)
Replies (1)
Replies (1)
Replies (1)
But yeah it comes with a cost versus plain dynamic linking.
Replies (2)
So just like today then? (Tongue only partially in cheek.)
Sounds like a good idea in general. Memory savings are a welcome side-effect.
Static linking is simpler but does away with those advantages.
I suppose much hatred against DL isn't the concept itself, but specific implementations. Like, any which do the versioning / dependency management badly.
Replies (1)
You can't just strip and inline the parts of the lib you need. You still probably need to pack in the DLLs you want in case the end users might not have a way to easily procure them elsewhere. Its a big ol' mess...
Replies (1)
Then I want to use Library Z but it requires version 1.45 of the DLL and I need to use 1.47 for a new feature but it is incompatible with Library Z and so now there is a conflict that can't be resolved.
Software T requires version 2.3 but my Linux distribution only ships version 1.8 and so I can't use that software until the distro updates at some indeterminate time in the future.
Software G requires version 2.3 but Ubuntu ships version 1.7 and Gentoo ships 1.97 and Debian only has 1.6 installed so the number of linux distros that can run the software is limited.
Replies (3)
If dynamic linking is used right, it has a lot of advantages. libSystem/dyld_shared_cache in darwin/XNU is a good example how to do it right.
Replies (1)
I want to use LibraryA in ProgramA and in ProgramB. It would be nice if they could both use the same binary, that way I can save some storage. Also, if I notice a problem in LibraryA, I could fix that and just replace that.
But inevitably, you get to a position where you need to make a change to LibraryA that would make it incompatible with previous versions. There's no nice, clean way to have both all producers and all consumers be both backwards and forwards compatible. Or, at the very least, you have to be aware that's what dynamic linking is asking of your software, that it be both backwards and forwards compatible.
Replies (1)
The biggest problem is that much like Haskell or Scala, using it causes you to realize that you hate working with anything else, likely making your job satisfaction decrease because you're never going to move your org off Ansible or whatever.
Libraries developers breaking API contracts and developers hard requiring only the latest version is what is making a mess.
If there is one thing I like about the BSDs and distros like alpine and arch is how easy it is to create a new package spec. Also easy to setup a repo.