LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   lots of ram, do you need swapspace? (http://www.linuxquestions.org/questions/linux-newbie-8/lots-of-ram-do-you-need-swapspace-337600/)

servnov 06-27-2005 08:29 AM

lots of ram, do you need swapspace?
 
All the desktop systems I manage and play with never use the disk swap space i partitioned for it. My home computer has 1024mb ram...and again never uses its swap space. I use disk space and would like to have that 2 gigs i have under swap. How much swap do I really need, if any?

LinuxLala 06-27-2005 08:41 AM

With all that RAM you don't need to apply the "Swap should be 2X" ram formula. I gues you could work with 256MB easily.

cs-cam 06-27-2005 08:41 AM

I have plenty of RAM also but I still have 768MB for swap. You probably don't need it but it's nice to have. Should you run out of RAM for some reason, having swap for the kernel to page to saves it dumping other stuff which it will then need to read later and slow things down. I also have 520GB of disk space so having a little bit for swap doesn't hurt at all. You certainly don't need 2GB though if you have 1GB of RAM. If you're that desperate for the space, cut it down to 512MB or even 256MB, but if it were me I'd still keep it.

masonm 06-27-2005 10:21 AM

As the others have said, 2G is far more than you need. The 2X RAM is up to 1G RAM. A 1G or smaller swap will be more than enough. Something around 500M should be plenty.

servnov 06-27-2005 10:51 AM

Thanks for the help. Say for example, I used up all ram space and didn't have any swap...what's the worst that can happen? Or, in other words, what would happen if your kernel needed to use swap but you didn't have it? Just disk swaps taking more time, but no real harm?

foo_bar_foo 06-27-2005 04:04 PM

swap is not really just extra RAM the way people think of it or like it was in 1980's
the kernel uses swap to hold application data that is not already on disk
stuff like libraries and the applications themselves are already on disk and can just get reread
but unique data that is generated on the fly goes in the swap que imediatly when it is created so it can be swap out in a hurry if needed. This includes stack and heap data for running proccesses and these pages are called anonymouse mappings because they don't corespond to things that can be read from disk. Is there still a swap que when there is no swap ? certainly the kernel will be confused because it is designed at it's core to use swap.
the kernel can just eject clean pages that are backed be disk no problem. The kernel generally does a pretty good job of flushing these pages when they get dirty so they stay clean and ejection can be real fast. annonymouse pages on the other hand can oly be clean and ejected when they have been flushes to swap cause no other disk file exists for them. Swap is their disk files by design.
If you don't have swap the kernel vm page allocation system is unballanced and cannot function properly.
the kernel will constantly be doing more work possibly thrashing pages or doing extra disk writes to figure out how to get clean memory.
in my opinion this will cause you machine to run slower as the kernel struggles to keep more pages clean even if swap is not ever used but i'm not sure.
and i think without swap if an app gets out of controll alocating memory your system might freeze rather than be able to recover

servnov 06-27-2005 04:27 PM

cool. thanks for the thought-out post. I guess I will use 256-512mb of swap then.

rstewart 06-27-2005 05:21 PM

What about systems that use Linux in an "embedded" application where there is no real disc, just a flash drive to boot from/get things started and plenty of RAM to hold evrything once the embedded app is up and running?

DaWallace 06-27-2005 06:24 PM

having swap is good. without it your system is likely to start killing processes or thrash indefinitely, meaning make the disk go insane and freeze.

malbery 03-19-2006 03:01 AM

Well, I have just that: a mini itx system with a card flash. I'm disabling my swap, I'll post back if I have problems. (1Gb RAM is surely enough?)


All times are GMT -5. The time now is 09:19 PM.