That behavior with Linux is absolutely real, and it’s very weird that it hasn’t been fixed in over a decade. It’s due to the default OOM (out of memory) killer being way too conservative with killing an application when the memory is completely full and disk swapping. Some people have solved this with an app that watches for OOM situations and acts with more decisiveness to kill an offending application before it swaps and brings the system to a halt, called EarlyOOM.
That still isn’t quite as good as Windows handling though, as Windows can generally handle those situations without killing the application at all.
toddestan@lemmy.world 1 week ago
Windows has had to deal with memory pressure a lot more than Linux. Some of this is bloat, but historically there’s also just been a lot of low end systems sold with Windows. All of the Windows 7 systems sold with 1GB, the Windows XP systems sold with with 256MB, running Windows 98 in 16MB, and so on.
Windows is always looking for memory it can page out and does a lot of preemptive paging so that if it suddenly needs a bunch of free RAM - like if the user suddenly launches some memory hog of an application, Windows has it available. Windows is also a bit smart about it - it’ll page things out but still keep the data in RAM too. So for example an application idle in the background will be paged out in case Windows needs that memory, but it’s also kept in RAM so if the user pulls the application back up, Windows doesn’t have to read everything back from the page file either.
This has lead to complaints about Windows constantly thrashing the disk and doing things in the background, but there is some method to the madness. Though I will complain that Windows still seems to do this even in situations where the PC has a lot of RAM and large amounts of it aren’t being used.
The Linux kernel, on the other hand, doesn’t do a lot of this like Windows does. Which is fine so long as you have enough RAM. But in a situation where there isn’t a lot of free RAM and suddenly the user launches a big application, the kernel suddenly has to do a bunch of swapping to free up memory and that can take a bit, especially if the drive is slow.
The Linux kernel does have a “Swappiness” setting that can modify its behavior, but I’ve never really played around with that myself.
douglasg14b@lemmy.world 1 week ago
Thank you for thoughtfully engaging. I appreciate your knowledge.