From owner-freebsd-questions@FreeBSD.ORG Thu Oct 2 17:14:37 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89AEB106568C for ; Thu, 2 Oct 2008 17:14:37 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from mail.potentialtech.com (internet.potentialtech.com [66.167.251.6]) by mx1.freebsd.org (Postfix) with ESMTP id 58CF58FC22 for ; Thu, 2 Oct 2008 17:14:37 +0000 (UTC) (envelope-from wmoran@potentialtech.com) Received: from vanquish.ws.pitbpa0.priv.collaborativefusion.com (pr40.pitbpa0.pub.collaborativefusion.com [206.210.89.202]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.potentialtech.com (Postfix) with ESMTPSA id 5C46AEBC3F; Thu, 2 Oct 2008 13:14:36 -0400 (EDT) Date: Thu, 2 Oct 2008 13:14:35 -0400 From: Bill Moran To: Kirk Strauser Message-Id: <20081002131435.efa1d07f.wmoran@potentialtech.com> In-Reply-To: <200810021004.56210.kirk@strauser.com> References: <200810020958.54563.kirk@strauser.com> <200810021004.56210.kirk@strauser.com> X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.11; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: More RAM for buffers? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Oct 2008 17:14:37 -0000 In response to Kirk Strauser : > On Thursday 02 October 2008, Kirk Strauser wrote: > > > I have an AMD system with 6GB of RAM. From dmesg: > > > > usable memory = 6428237824 (6130 MB) > > avail memory = 6203797504 (5916 MB) > > > > However, most of it is just sitting there when it looks like it could be > > used for buffers or cache: > > On another AMD64 machine, also with 6GB of RAM, I have: > > Mem: 482M Active, 1044M Inact, 363M Wired, 3792K Cache, 214M Buf, 4023M Free > Swap: 8192M Total, 8192M Free > > I can understand that on the other machine maybe inactive memory is more > beneficial than cache or buffers, but this system is just sitting there > with 4GB free (and the exact same amount of buffer memory as on the other, > which seems a little too coincidental). inactive, cache, and buffer are all different types of "buffer". I've never been 100% clear on the exact differences, but it basically has to do with where the data in RAM came from. Depending on whether it was a VM page, or a disk page will determine what bucket it goes into when it moves out of active. I'm fairly sure that inactive is memory used by program code. When the program terminates, the memory is marked as inactive, which means the next time the program starts the code can simply be moved back to active and the program need not be reloaded from disk. Buffer and cache memory are disk data held at different points within the kernel. I've never been 100% clear on the difference, and I believe it depends heavily on a thorough understanding of how the kernel works. The other rule of thumb I've heard is that the closer memory is to the left side of top output, the less expensive it is for the kernel to move it to active ... inactive being the most efficient and cache requiring the most work by the kernel ... I could be wrong, though. I know that a lot of what I'm saying isn't authoritative, so I hope I'm not remembering any of this wrong. I think to fully understand how it works you'll need to read _The_Design_and_Implementation_. -- Bill Moran http://www.potentialtech.com