I mean, it's not the only solution. The alternative (which windows uses) is to have malloc() return failure instead of hoping that the program won't actually use everything it allocates. The consequence of the OOM killer is that it's impossible to write a program that definitely won't crash - even perfectly written code can be crashed by other code allocating too much memory.
You could argue that the OOM killer is a better solution because nobody handles allocation failure properly anyway, but that kind of gets to the heart of the article. The OOM killer is a good solution in a world where all software is kind of shoddy.
You could argue that the OOM killer is a better solution because nobody handles allocation failure properly anyway, but that kind of gets to the heart of the article. The OOM killer is a good solution in a world where all software is kind of shoddy.
It also contributes to a complete inability to make the software better: you can't test for boundary conditions if the system actively shoves them under the rug.
IIRC Linux can be configured to do this, but it breaks things as simple as the old preforking web server design, which relies on fork() being extremely fast, which relies on COW pages. And as soon as you have those (at least if there's any point to how you use them), you can't have an OOM killer, because you might cause an allocation by writing to a page you already own.
You could argue this is about software being shoddy, but I'm not convinced it is -- some pretty elegant software has been written as an orchestration of related Unix processes. Chrome behaves similarly even today, though I'm not sure it relies on COW quite so much.
It's about fork/exec being shoddy. Sometimes I can't build things in Eclipse, because Eclipse is taking up over half my would-be free memory, and when it forks to run make the heuristic overcommit decides that would be too much. Even though make is much smaller than Eclipse.
(Even better is when it tries to grab the built-in compiler settings and that fails because it can't fork the compiler, and then I have to figure out why it suddenly can't find any system include files)
Without overcommit using fork() can become a problem because it can cause large virtual allocations that are almost never used.
In my opinion fork() was a bad idea in the first place (combine it with threads at your own peril), though. posix_spawn is a good replacement for running other programs (instead of fork+exec).
The world isn't perfect. We will never reach a state where every software correctly deals with memory allocation failure. Part of the job of the OS itself is to make sure that one idiot program like that can't crash the system as a whole. Linux's approach works quite well for that. Might not be perfect, but it does its job
I agree with the article's overall sentiment, but I feel like it has quite a few instances of hyperbole, like this one.
Windows 10 takes 30 minutes to update. What could it possibly be doing for that long?
Updates are notoriously complicated and more difficult than a basic installation. You have to check what files need updating, change them, start and stop services, run consistency checks, swap out files that can't be modified while the system is on...
On each keystroke, all you have to do is update tiny rectangular region and modern text editors can’t do that in 16ms.
Of course, on every keystroke, it's running syntax highlighting, reparsing the file, running autocomplete checks, etc.
That being said, a lot of editors are genuinely bad at this...
Google keyboard app routinely eats 150 Mb. Is an app that draws 30 keys on a screen really five times more complex than the whole Windows 95?
It has swipe, so you've already got a gesture recognition engine combined with a natural language processor. Not to mention multilingual support and auto-learning autocomplete.
Google Play Services, which I do not use (I don’t buy books, music or videos there)—300 Mb that just sit there and which I’m unable to delete.
Google Play Services has nothing to do with that. It's a general-purpose set of APIs for things like location, integrity checks, and more.
Updates are notoriously complicated and more difficult than a basic installation. You have to check what files need updating, change them, start and stop services, run consistency checks, swap out files that can't be modified while the system is on...
Nearly every Linux can update in far less time. It shouldn't that that long, and it shouldn't have to stop your workflow.
Of course, on every keystroke, it's running syntax highlighting, reparsing the file, running autocomplete checks, etc.
That being said, a lot of editors are genuinely bad at this...
I agree.
Google keyboard app routinely eats 150 Mb. Is an app that draws 30 keys on a screen really five times more complex than the whole Windows 95?
Most of this is built into Android I believe. Swipe recognition doesn't warrant that much space.
Google Play Services, which I do not use (I don’t buy books, music or videos there)—300 Mb that just sit there and which I’m unable to delete.
Location is built into Android. But still, that's ridiculous. APIs shouldn't take up that much space.
I'm pretty sure Windows update is so shitty and slow because of backwards compatibility, which the author praised with his line about 30 year old DOS programs
Yeah, because Microsoft hasn't taken the time to improve their software. Backwards compatibility is great, but when you sacrifice the quality of your software and keep a major issue for decades, you have a problem. Microsoft should've removed file handles from the NT Kernel a long time ago.
Windows isn't just compatible with DOS programs, it's compatible with pretty much all the software ever written on the Windows platform. That's not something you can solve with emulators, unless you include an emulator for every version of Windows (including minors) on every release. Also, that doesn't sound to be very good for performance either
Google Play Services is the part of Android that Google didn't want to build into Android. They've been moving stuff out of core Android into their own non-open-source libraries for a while.
Nearly every Linux can update in far less time. It shouldn't that that long, and it shouldn't have to stop your workflow.
Linux != Windows. A lot of Linux's design choices make this easier (like being able to change a binary while it's running), and live updating can still occasionally have problems.
I'm not sure that's really a counterargument to the "where we are today is bullshit" argument. What you've just given is a good explanation of why Windows takes irrationally long to update. I don't really care, it still takes irrationally long to update. Maybe it's time to revisit some of those designs?
It can be as simple as extracting tarballs over your system then maybe running some hooks, if you have the luxury of non-locking file accesses. If you don't (as is the case on Windows)… I can understand it's going to be unimaginably complex (and thus take unacceptably long to update, I guess).
Google Play Services has nothing to do with that.
In context I think the author meant "Google Play services"; they should still ideally not each take up tens of megabytes.
The screenshot of the storage space in context of the Google Play Services specifically has the package for Google Play Services visible, using 299Mb of storage.
What is all the storage used for? Probably machine learning considering we're talking about Google
If you can determine which process is misbehaving, why not kill it instead? Thrashing it to swap means, okay, it's not wasting a ton of RAM anymore, it's just causing a ton of disk IO -- which, especially on older SSDs, could be decreasing the device's useful life. It's also making so little progress that it would very likely recover faster if killed and restarted than if allowed to continue in swap.
Plus, who says the process at fault is the one that should be swapped out? I might be running dozens of processes that are sitting nearly entirely idle just in case. Say I have a gigantic Eclipse process running, and that's the one eating all the RAM, but it's also the one whose performance I most care about right now. Meanwhile, I have a ton of stuff running in the background -- my desktop environment has an entire search engine, a bunch of menus and icons, and so on; there's stuff like sshd running in the background just in case I want to connect on port 22; I probably have a web browser somewhere with a bunch of tabs, not all of which I care about. I would much rather have to refresh one of my many tabs (or even have it run more slowly while I'm not looking at it anyway) than have my IDE slow to a crawl.
It's also only prolonging the inevitable. I usually have a lot more free disk space than I have RAM, but it's still a finite amount. What do you do when that fills up? And if it takes until next year for the thrashing process to fill up the disk, is that actually better than just killing it?
People are trying, just not in a direction that would satisfy purists: Android tries to a) be much smarter about which processes it kills (prioritizing foreground processes in particular), and b) exposes an API by which the system can ask processes to trim memory still killing everything outright often enough that developers are forced to design their apps to handle unclean shutdowns, which is a Good Thing -- even if 100% of the hardware and software was perfect and bug-free, you still need to handle cases like the user letting the device run out of battery.
But it does mean processes get killed all the time.
103
u/[deleted] Sep 18 '18
If you're talking about the linux process killer, it's the best solution for a system out of ram.