From owner-freebsd-questions Fri Nov 19 11:51:18 1999 Delivered-To: freebsd-questions@freebsd.org Received: from europe.std.com (europe.std.com [199.172.62.20]) by hub.freebsd.org (Postfix) with ESMTP id D4ED514CFC for ; Fri, 19 Nov 1999 11:51:10 -0800 (PST) (envelope-from lowell@world.std.com) Received: from world.std.com (lowell@world-f.std.com [199.172.62.5]) by europe.std.com (8.9.3/8.9.3) with ESMTP id OAA01110; Fri, 19 Nov 1999 14:51:09 -0500 (EST) Received: (from lowell@localhost) by world.std.com (8.9.3/8.9.3) id OAA23688; Fri, 19 Nov 1999 14:51:08 -0500 (EST) Date: Fri, 19 Nov 1999 14:51:08 -0500 (EST) Message-Id: <199911191951.OAA23688@world.std.com> From: Lowell Gilbert To: jcm@dogma.freebsd-uk.eu.org Cc: freebsd-questions@freebsd.org In-reply-to: (message from Jonathon McKitrick on Thu, 18 Nov 1999 14:44:39 +0000 (GMT)) Subject: Re: Memory Info References: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >Date: Thu, 18 Nov 1999 14:44:39 +0000 (GMT) >From: Jonathon McKitrick > >I've seen a lot about this lately, and I've heard it said that 'free >memory is wasted memory'. Seems trivially true, no? >If this is the case, does this mean FreeBSD keeps everything possible in >memory and then swaps out to VM when it needs more? This is a badly-worded question -- that, in itself, indicates some of what you're missing. VM *is* memory; the 'M' *stands* for the word "memory." Specifically, VM is an abstraction of memory space that allows parts of that space to be kept in different kinds of storage at any particular time. And, to a zeroth approximation, you're about right; FreeBSD keeps useable data in nearly every RAM page and uses swap space on disk to back up pages when it needs to reuse them for something new. That's only a rough approximation, though. Pages can get swapped to disk well before they're needed for other purposes, and then there's no wait on the disk write before they can be re-used. They don't have to be cleared immediately, though, so if the original task accesses the page before it's needed for anything else, that page is still in RAM (and the swap copy of the page is invalidated). This is *still* a very rough description, but I think it answers your actual questions. > How are unnecessary >page faults and disk accesses avoided with this method? Quite well. A RAM page is never assigned to a new use unless that that use *needed* RAM. [I realize I'm being a little disinguous here; the problem is not when to reassign a page, but which one to reassign. Making that guess is a rather complicated statistical problem, but amounts to guessing which current page is least likely to be needed again soon.] >I am a bit of a neophyte, but I am right in the middle of an 'Intro to >Operating Systems' course, and we just finished memory mgmt and virtual >memory. You might want to discuss some of this with your professor rather than a bunch of people who don't know you and can't see you to pick up on body language. Be well. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message