Hacker News new | ask | show | jobs
by colanderman 5615 days ago
Swap still provides one important function: it allows large, inactive, long-running processes to be moved from RAM to make room for more caches and buffers.

That said, if you never fill your RAM with buffers/cache, then of course swap makes no sense.

1 comments

On the other hand, one could say that moving a large process from RAM to swap certainly makes it nearly inactive and long-running...

Memory is cheap. I'd rather pay a little more and have the long-running processes stay in memory than worry about my more active processes ending up in swap accidentally. If I wish to reserve 1GB for these long-running processes in RAM instead of swap, I can still win by buying 2GB more RAM.

Besides there's always some disk-backing you can't generally avoid: pages containing read-only executables can be purged from memory when unused and re-read from the original .so or binary when needed. This is something that would never go to swap anyway.