From owner-freebsd-questions Wed Feb 6 22:44: 5 2002 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-10.mail.nl.demon.net [194.159.73.20]) by hub.freebsd.org (Postfix) with ESMTP id 7528D37B416 for ; Wed, 6 Feb 2002 22:43:59 -0800 (PST) Received: from [212.238.194.207] (helo=mailhost.raggedclown.net) by post.mail.nl.demon.net with esmtp (Exim 3.33 #1) id 16YiHm-0005wR-00 for freebsd-questions@FreeBSD.ORG; Thu, 07 Feb 2002 06:43:58 +0000 Received: from angel.raggedclown.net (angel.raggedclown.intra [192.168.1.7]) by mailhost.raggedclown.net (Ragged Clown Mail Gateway [buffy]) with ESMTP id 5D97A13040 for ; Thu, 7 Feb 2002 07:43:57 +0100 (CET) Received: by angel.raggedclown.net (Ragged Clown Host [angel], from userid 1001) id 6DF0B22590; Thu, 7 Feb 2002 07:43:57 +0100 (CET) Date: Thu, 7 Feb 2002 07:43:57 +0100 From: Cliff Sarginson To: freebsd-questions@FreeBSD.ORG Subject: Re: Swap Space?????? Message-ID: <20020207064357.GC7234@raggedclown.net> References: <000201c1af9d$e2adc5d0$ab038bd8@blah> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000201c1af9d$e2adc5d0$ab038bd8@blah> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Feb 06, 2002 at 10:08:25PM -0800, Remington wrote: > What exactly is the purpose of swap space? I heard swap space size > should be equal to the amount of RAM so mine is 524MB, but its never > used. I use top and it ALWAYS at around 6KB in use > Mmm.. two questions in one day on O/S concepts :) Simply put. It extends the amount of "memory" your computer has. It is used by the O/S when there is not enough "real" memory for all of the procesess competing for it. It then makes decisions based on fairly complicated alogorithms on which bits of real memory to "swap" to the disk swap area, i.e. it writes them out to swap, and re-uses the space freed up for some other process. At a later stage, when the process whose memory has been swapped out becomes a candidate for being run again it will swap this memory back in. As stated, how it decides this, and what gets swapped is complex, and different theoretical models exist for what it should do. The fact that you swap space is never used simply means you have never put so much demands on the real memory of the system that the kernel has never had to use it. Slightly complicating this story is that even if you see some swap space in use, it may not mean that you are permanently out of real memory, it may have been a transient need for swap space, and that space just hangs around so to speak. If you have 256MB of real memory and a swap space of 512MB, and you find that most of the swap space is in permanent use, then you probably need to buy some more real memory if your performance is an issue. How much swap space ? This is the perenenial question. I always use 2x physical memory, but if you search the archives you will come up with tons of discussion threads on what is the "right" amount. -- Regards Cliff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message