[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: why swap is important?



On Fri, 25 Feb 2005, j smith wrote:

> i have enough RAM, but Debian 3.0 installation screen
> says i'd better make a swap, why?

This is a common question.  Should be an FAQ.

In addition to the excellent points already made there is the point of 
performance.  Linux has several ways it can use RAM.  Running processes is 
the main reason but it also caches files to disk and buffers memory.

The reality is all systems have rarely used apps (and daemons) that are 
still needed.  If you don't have any swap then the system must keep them 
in memory.  This reduces the amount of RAM available for caching and 
ultimately reduces the overall performance of the system.

So while it is true (as is often cited) that swapping is a slow process it 
often doesn't significantly impact the user (particular if it is not 
terribly common, such as with modern system with lots of RAM) whereas 
having the extra disk cache improves system performance a lot.  If in 
doubt run a busy system with and without swap and see how it goes.  Man 
swapon and man swapoff for info on enabling/disabling existing swap.

Some older versions of Unix could not defragment memory without having 
swap but this is not true of Linux.

[1] Unless the system is thrashing.  Then you need more RAM.

Rob

-- 
Robert Brockway B.Sc.
Senior Technical Consultant, OpenTrend Solutions Ltd.
Phone: 416-669-3073 Email: rbrockway@opentrend.net http://www.opentrend.net
OpenTrend Solutions: Reliable, secure solutions to real world problems.
Contributing Member of Software in the Public Interest (http://www.spi-inc.org)



Reply to: