*BSD News Article 58436


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!spool.mu.edu!howland.reston.ans.net!news.sprintlink.net!news1!not-for-mail
From: root@dyson.iquest.net (John S. Dyson)
Subject: Re: Info needed
X-Nntp-Posting-Host: dyson.iquest.net
Message-ID: <4cpr6p$8cn@dyson.iquest.net>
Sender: news@iquest.net (News Admin)
Organization: John S. Dyson's home machine
References: <4cplfe$bpk@news.halcyon.com>
Date: Mon, 8 Jan 1996 01:15:05 GMT
Lines: 44

In article <4cplfe$bpk@news.halcyon.com>,  <javaman@halcyon.com> wrote:
>
>3) I read that FreeBSD uses alot of paging space, under X I had about 6
>   xterms, 2 Mosaic windows, and about 5 other clients running ( top showed
>   50 processes) when I ran out of VM.  I had 39 meg total real + page.
>   Is this unusual? Do I need more paging space?  Is the 2 x phyisical ram
>   enough?
>
There is alot of legend as to how much swap space that various OSes use,
including FreeBSD.  Basically, you need to back all of physical memory
with swap space.  After that the swap space will add to your total virtual.
So if you have 16MB of ram, and 40MB of swap, you should expect 40MB of
virtual.  The X server uses lots of VM, and that problem has been/is being
worked both by the XFree team and the FreeBSD team.  The default FreeBSD malloc
is very generous with VM space.  That has been fixed in the current code.
There is no rule-of-thumb as to how much swap space you need... Some people
say 2X (which is generally too low on a general purpose system), but I
have warned people that 4X is closer to reality and generally has some
safety margin (I have found that to be true on SVR4 also.)  Note that SVR4
is even less forgiving as to the VM overcommit...  My own system at home with
20MB ram tends to idle at 6MB of swap without running X, after I have loaded
the system with memory intensive applications.  The actual calculation is

Swap space needed = min(physical memory, total virtual space in all procs).

You can sometimes get by with less -- but the above is safe.

Note that the use of swap space does not denote inefficiency, but the
tradeoff is strictly that disk is cheaper than ram, and ram is faster than
disk.  For example, if there is data used in the initization of system daemons
that is used only once (or not often)  -- the system will put those pages onto
disk very readily,  perhaps even before "common sense" would indicate that
those pages should be paged out.  Note that if the pages are not used, they
needlessly take up valuable cache space, and the system has a dynamically sized
merged VM/Buffer cache scheme...

One more note -- you will not notice paging to occur until the system runs
out of memory -- in essence it tries to avoid paging until necessary and
does not do it gratuitously.  But, once it does, it pages out those pages that
have not been used often or recently first.

John Dyson
dyson@freebsd.org