Why swap used?
I read about swap:
"It is possible to run a Linux system without a swap space, and the system will run well if you have a large amount of memory -- but if you run out of physical memory then the system will crash, as it has nothing else it can do, so it is advisable to have a swap space, especially since disk space is relatively cheap." My free -m says: Code:
free -m Confused !! |
i run my debian without swap.
Code:
root@srvr:~# free -m never really crashed. i disabled swap on my fstab: Code:
root@srvr:~# cat /etc/fstab |
If you never hibernate and have enough RAM you do not swap file
|
Linux kernel uses swap (if available) even when having enough memory. When you have idle application just sitting in RAM doing nothing it is good thing to move it to swap so it does not occupy usable RAM.
Look for "swappiness" kernel parameter for more details. |
I'm not up on the latest kernel designs, but the historical reason that you needed swap even if you had full memory was that systems would swap out unused processes even if memory wasn't needed. One justification for that would be to make more room for disk caching, another might be to make room for memory that active processes might soon request.
Perhaps someone who is up on current design can tell us where it is now? |
Quote:
Quote:
Quote:
|
Yes, I should have said "wanted" or "might want".
There's also the good advice that the kernel probably knows better than you do when it comes to managing memory. On the other hand: you don't want tons of swap. For example, now that memory is no longer limited to 4 GB, you could theoretically have many gigabytes of swap available for paging, but paging a very large process is not necessarily what you want. I may not be using BigApp for a while, but when I do switch to it, I don't want to wait for it to be paged in. But - then we go back to my switching to OtherBigApp and having to wait because what I asked it to do needs memory that BigApp has tied up. Until we have so much fast ram that we never need all of it, there will always be trade-offs. I expect we'll see that day eventually - we already see it with hard drives (at least for most of us). I imagine that a future post here might begin "Back in the days when nobody had enough RAM to run all their apps..." |
The right question is not that, the right question is "why not to use swap when it increases performance even if it's by a small edge?" Is really that little file (you don't even need a partition) really bothering you that much?
It's a recurrent topic so I bookmarked one explanation some time ago, http://www.linuxforums.org/forum/lin...tml#post686033 Quote:
When you have swap and it starts filling up, the performance degradation is like an alarm that tells you "save your work NOW!". |
All times are GMT -5. The time now is 11:54 AM. |