[clug] to swap or not to swap that is the question

Kim Holburn kim.holburn at anu.edu.au
Tue Jun 29 12:40:00 GMT 2004

On 2004 Jun 29, , at 10:24 PM, Richard wrote:

> Kim Holburn wrote:
>> Suppose you have a system with say 1G of RAM and swap of 2G.  How is 
>> that better than say a system with 2G of RAM (or even 3G RAM).
>> Is it because HD is so much slower that the wait causes everything to 
>> slow down?
> I'll throw in a comment here. I think the bottom line is that ideally 
> the set of memory pages that are used should always be kept in RAM, 
> and if you /really/ need them, then putting them in swap is better 
> then not having them at all. Therefore, you should always have as much 
> RAM as practical, and enough swap space to cope with bizarre spikes 
> (HD space being cheap and all). You should never have swap space in 
> preference to more RAM though.
> I've heard of admins who are so insistent that everything should be in 
> RAM at all times that they don't run any swap at all and use crashing 
> processes as an indication to add more RAM. The theory runs that swap 
> is only a short step from thrashing the disk, which will cause 
> performance to nose dive, which is only a short step from crashing the 
> process anyway. I think this a bit extreme.

Some of my systems here have no hard disk so it's moot.  But what you 
say gives me lots of questions.  If processes crash if they don't have 
enough memory what if they don't have enough memory and swap?  Does 
having swap just cause lots of thrashing before the end?  Thrashing 
slows down the end?

Would having a RAM disk swap space do anything useful?

> That's my understanding at any rate.
> Richard
Kim Holburn
IT Manager, Canberra Research Laboratory
National Information and Communication Technology Australia
Ph: +61 2 61258620 M: +61 417820641
Email: kim.holburn at anu.edu.au  - PGP Public Key on request
Aust. Spam Act: To stop receiving mail from me: reply and let me know.

Democracy imposed from without is the severest form of tyranny.
                           -- Lloyd Biggle, Jr. Analog, Apr 1961

More information about the linux mailing list