Comment by chowells

17 hours ago

The ideal would be to go into swap without becoming unresponsive, so that the user can quit a program of their choice to free memory. If you really want to make an issue out of it, 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.

> The ideal would be to go into swap without becoming unresponsive, so that the user can quit a program of their choice to free memory.

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.

  • >> do something like pre-X macOS, where it would provide a warning when you are getting close to running out of memory

    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.

Swap is extremely slow. And if running it on a high-end NVMe, you better hope you don't swap often.