Date: Fri, 8 Feb 2002 08:23:05 -0600 From: "Mike Meyer" <mwm-dated-1013610186.bcb5d9@mired.org> To: Cliff Sarginson <cliff@raggedclown.net> Cc: questions@freebsd.org, madriax@garlic.com Subject: Re: Swap Space?????? Message-ID: <15459.57161.701213.713628@guru.mired.org> In-Reply-To: <123178183@toto.iv>
next in thread | previous in thread | raw e-mail | index | archive | help
Cliff Sarginson <cliff@raggedclown.net> 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. <mike -- Mike Meyer <mwm@mired.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15459.57161.701213.713628>