[oclug] swap/memory tools

Adrian Irving-Beer wisq-oclug at wisq.net
Mon Nov 29 09:53:14 EST 2004


On Mon, Nov 29, 2004 at 05:15:23AM -0500, GR Gaudreau wrote:

> I have 512 MB of RAM, do I really need a swap file?

Well, particularly if the space is already allocated, it shouldn't
hurt to activate it and let the kernel decide.

> Would I be better off with a cache... if I don't already have one?
> How do I know I have one, if I do?

You know you have one because you're running Linux. :)  It's standard
in all the OSes these days, and DOS was pretty much the only OS I know
of where it a) wasn't available for many versions and b) was disabled
by default.

To see it 'in action', check out the output of 'free'.  On my laptop
now after a night of inactivity:

             total       used       free     shared    buffers     cached
Mem:        508528     467556      40972          0     156280      59276
-/+ buffers/cache:     252000     256528
Swap:       979924          0     979924

Note the 'cached' field.  This is the amount of physical RAM being
used to cache disk access.  'buffers' is kernel buffering.

Also note the '-/+' row; this is how much is actually being used by
programs, because the rest is being used for buffers and cache.

Another way to demonstrate this is to read a large file, then read it
again immediately.  The second one should take much less time and
almost no disk access; that's because it came from the cache.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://tux.oclug.on.ca/pipermail/oclug/attachments/20041129/1bde0030/attachment.bin


More information about the OCLUG mailing list