5 ms·
> Nor is it customary to check for a "memory tight" condition and have programs restrain themselves, perhaps by starting fewer tasks in parallel, opening fewer
by AnthonyMouse 10y ago
> Nor is it customary to check for a "memory tight" condition and have programs restrain themselves, perhaps by starting fewer tasks in parallel, opening fewer connections, keeping fewer browser tabs in memory, or something similar.
These aren't mutually exclusive and are actually complementary with swap.
If you have more than enough memory then swap is unused and therefore harmless. The question is, what do you do when you run out? Making the system run slower is almost always better than killing processes at random.
And it gives processes more time to react to a low memory notification before low turns into none and the killing begins, because it's fine for "low memory" to mean low physical memory rather than low virtual memory.
It also does the same thing for the user. "Hmm, my system is running slow, maybe I should close some of these 917 browser tabs" is clearly better than having the OS kill the browser and then kill it again if you try to restore the previous session.
- qznc 10y agoI cannot remember a single occasion, where my desktop recovered when it started swapping. Always, the whole system locks up and I need to reboot. Thus, better kill some random processes instead of all of them.
- Razengan 10y ago> I cannot remember a single occasion, where my desktop recovered when it started swapping. ..which operating system is that?
- qznc 10y agoUbuntu
- pareidolia 10y agoSounds to me your swap is not swapon'd. I get the same behaviour when I'm not running swap and memory is depleted.
- gumoro 10y agoAlways, really? Perhaps I'm lucky but this happens quite frequently with my system (dev workstation, so browser with lots of tabs, IDE, my own app/server stuff, other "power/mem-hungry" dev tools...), and I always manage to keep it sane/healthy: - notice system starts swapping (if you do not monitor that, to me it sounds as careless as driving on the highway on 2nd gear and ignoring engine noise -- ideally the OS could proactively help here but unfortunately I don't know a good "automated" tool) - find out which process/app uses the most memory (Linux can even tell you which ones use the most swap space [1]) - decide which one you want to (gently|forcefully)-(quit|restart|whatever). Exercise judgment. [1] http://stackoverflow.com/questions/479953/how-to-find-out-which-processes-are-swapping-in-linux http://stackoverflow.com/questions/479953/how-to-find-out-wh...
- jstimpfle 10y ago> Making the system run slower is almost always better than killing processes at random. In practice, heavy swapping (forth and back) makes it impossible to even kill the culprit manually (because I can't open an xterm or whatever). While there is often no benefit to have the processes continue running that slow. Also, idealistically programs should be written with the assumption that the machine could go down at any instant. Having a few more cases where the program is killed will have the effect that the program is better tested and debugged.