by phiresky · 3mo ago · 0 comments
By killing a program, yes, but how else do you expect it to work? If your RAM is not enough you have to kill stuff. And I really doubt you mean to say that Windows is _more RAM efficient_ than Linux, because that's kind of absurd. Maybe Firefox is less RAM efficient than Chrome.
Edit: MacOS I wouldn't doubt being better in RAM management than the others because they have been selling their devices with ridiculously low amounts of RAM for decades.
How does it work on Windows and MacOS where I don't get the same freezes and random programs aren't killed by the OS? Because I'd expect it to work like that.
There is this false dichotomy, a black and white kind of thinking on display.
> And I really doubt you mean to say that Windows is _more RAM efficient_ than Linux
What I'm saying ought to be clear to anyone willing to listen. My system should not get into an unrecoverable freezing state when I am doing routine tasks on a fresh install of an OS. And the community that is supposed to champion this OS should not then shift the blame to me if I complain about it.
This video from Mark Russinovich is a classic explaining it. It is old but still relevant.
https://m.youtube.com/watch?v=AjTl53I_qzY&ra=m
"My system should not get into an unrecoverable freezing state[..]"
There is a good precedent for what you want: Safety critical embedded systems. Your car ECU should not be in an unrecoverable freezing state when you want to break.
These embedded systems also are known to be terribly memory inefficient because every bit of memory is statically assigned and never reused.
So, it is not that what you want is impossible, it's just wasteful and expensive.
Linux and Windows sit on slightly different points on this spectrum (opposite of said embedded systems) and what you perceive as Windows' better behavior under memory pressure has a price too.
I've moved to Linux from Windows some years ago but the first thing that shocked me was precisely the abysmal performance around low memory availability.
Got my system stabilized eventually by means of some magical incantations but this wasn't a pleasant experience and I wouldn't want to repeat it.
It's beyond me how come Linux is so decrepid in this particular area compared to Windows.
And back when I was forced into running Windows, I used to get memory-related freezes daily. Literally daily.
So I’m really not convinced the situation is drastically different there. I mean if it were that simple, Linux would have fixed it already.
On Windows it's usually the hard drive being over-used that makes things drag for me.
You can pick applications from that list and choose between "Resume" (for "paused" applications) or "Force Quit".
At no point the system becomes unresponsive.
That is, if you are lucky enough for the dialogue to pop up.
I do agree that when you get the dialogue, it is a much better user experience than under Linux.
Surely that's obvious to other people aside from me. It's an attended system, not a headless server in a rack hundreds of miles away that must not ever alert someone.
Also I know linux has `cgroup_enable=memory` setting in /etc/default/grub, that's for Docker/K8S to be able to watch over containers RAM. It's not enabled by default as it slows down OS a little. Don't know if it's related to my first point.
Linux already does this. The issue is when your swap is full too, or you’ve exhausted your RAM at such a rapid pace that the disk IO cannot keep up with the read and writes to swap.
I’ve seen Windows choke under the same conditions too.
> do something like pre-X macOS, where it would provide a warning when you are getting close to running out of memory, so that a user might have the chance to do something before the current process starts getting swapped out.
This is where the desktop and the kernel being entirely separate organisations (not even projects, but literal organisations) makes things a touch harder. And those DEs aren’t even Linux specific either. So any tooling would have to portable (which, in fairness, should be possible with POSIX in this particular scenario).
I think KDE does provide tools here for gracefully handling memory constraints. But that’s just one desktop environment of many.
And I've run out of memory while compiling packages (I'm looking at you, composable-kernel) on Gentoo. It's not like it can notify me and I close things in the milliseconds it takes for a few more GCC processes to spawn and allocate and fault all the remaining memory.
I don't know what that means. When your system is in such extreme memory pressure, it comes to a crawl, exactly because your memory use can't outpace your IO. There's no 'cannot keep up' state.
Btw, there's (at least) two sides to swap:
(1) While there's plenty of headroom, you might still want to swap out 'cold' memory, so you can keep more files cached in RAM.
(2) When you are (nearly) out of memory, you need to evict to swap so that you don't run out-of-memory.
Swap mostly helps you, when you have plenty of cold memory that are pretty much never accessed again. Or when you have applications that you switch, but that you don't use concurrently.
When your active working set is bigger than your RAM, then, yes, swap is slow.
It's been less than 24 hours since an OOM killer was identified as responsible for a bug I was experiencing.