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

Martin Pool mbp at sourcefrog.net
Wed Jun 30 06:53:56 GMT 2004


On 30 Jun 2004, Kim Holburn <kim.holburn at anu.edu.au> wrote:
> 
> On 2004 Jun 30, , at 9:54 AM, Martin Pool wrote:
> >Suppose you start a program at bootup that allocates and writes to 4MB
> >of memory, and then never touches it again.  In fact, suppose the
> >process sleeps and never runs again at all.
> 
> Ummm, why run it then?

As I said, obviously you don't have a program exactly like that.  It
was an exaggerated example for clarity of explanation.  A more
realistic example is gdm which stays loaded but idle for days at a
time while I'm logged in.  Keeping its heap in RAM would serve no
useful purpose, but would clutter up memory that would be better used
for disk cache or whatever.

As I write this my 1GB machine is using 134MB of swap.  It's not
thrashing by any means, in fact it's perfectly happy and doing barely
any disk IO at all.  I think it would be slower without swap.

But you don't have to believe me if you don't want to.  Do your own
benchmarks.

-- 
Martin 


More information about the linux mailing list