D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Bah! Disks! Bah!

 

Quoting Gordon Henderson <gordon+dcglug@xxxxxxxxxx>:

On Fri, 5 Feb 2010, Rob Beard wrote:

My laptop has 4GB of RAM but I still have something like 256MB swap on my hard drive, I gather the kernel is inteligent enough to swap out some things even if there is bags of memory available.

The eternal debate (or yet another holy war ;-)

In a modern Linux system, you do not need swap, however if you have
some, then it may be used in some circumstances - e.g. the kernel may
elect to move some processes (or data) to it if there is a need for
more RAM for things like disk buffers - and this can improve
performance - e.g. if your Linux distro includes getty on a text
console, when was the last time you actually used it? So swap it out
and you get a few MB more for disk/file buffers...

This is what I figured, hence the small amount of swap. Saying that I don't think I've ever used anywhere near 4GB, it was cheap and the maximum my notebook would take, since I bought my notebook I notice memory prices have gone up at least a third on DDR2 memory.

Older Linux and other *nix systems did need swap due to the way the way
the virtual memory system was designed and the old rule of "double the
size of main memory" was common.

These days, if you've got enough RAM you don't need swap and a modern
Linux kernel is OK without it.

And after saying that, I'll add that with one exception, I always add
swap to a system I build "just in-case" and it's usually double the RAM
size. Old habits die hard..

Yep, I installed Xubuntu 8.04 on a laptop for a friend yesterday. It has 192MB Ram and I found that it would swap out about 160MB into swap. I ended up giving it 1GB swap as the hard drive is destined for another laptop with a knackered CD drive which has 512MB Ram. I was surprised how snappy it seemed actually. Presumably as I was only running Firefox on it, then the majority of background stuff was not being used.

One thing I'm not entirely clear about is the buffers and cache.

For instance on your embedded system, it says...

Mem:    257208k total,   238644k used,    18564k free,     2516k buffers
  Swap:        0k total,        0k used,        0k free,    35164k cached

So, about 2.5MB are used for buffers and about 3.5MB used for cache, I'm assuming they are separate? (so combined the buffers and cache are using about 6MB?)

What I'm wondering is if say, the cache is like the old SmartDrive cache on DOS where rather than writing directly do disc, it holds what it needs to write in a cache for a couple of seconds until the disk is pretty much idle to speed up writing?

If that is the case, what is the buffer for?

Ta,

Rob




--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html