From owner-freebsd-questions Fri Feb 8 6:23:16 2002 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (dsl-64-192-6-133.telocity.com [64.192.6.133]) by hub.freebsd.org (Postfix) with SMTP id 898DE37B405 for ; Fri, 8 Feb 2002 06:23:09 -0800 (PST) Received: (qmail 36705 invoked by uid 100); 8 Feb 2002 14:23:06 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15459.57161.701213.713628@guru.mired.org> Date: Fri, 8 Feb 2002 08:23:05 -0600 To: Cliff Sarginson Cc: questions@freebsd.org, madriax@garlic.com Subject: Re: Swap Space?????? In-Reply-To: <123178183@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ From: "Mike Meyer" X-Delivery-Agent: TMDA/0.44 (Python 2.2; freebsd-4.5-STABLE-i386) 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 Cliff Sarginson types: > 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 > 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 a historical aside, this behavior is more properly called "demand paging". A process is "swapped out" if all of it's memory has been moved to the swap device. The hardware Unix was initially implemented on didn't support demand paging, which meant that all of a processes memory had to be resident in real memory for the process to turn. So entire processes were selected for swapping, instead of just select pages from those processes. When hardware that supported demand paging became generally available, using the swap space for paging was a pretty obvious move. Processes can still be swapped out. If it happens to anything but idle processes, your system probably needs more real memory. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message