From owner-freebsd-questions@FreeBSD.ORG Wed Aug 13 16:40:01 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 01C4B1065674 for ; Wed, 13 Aug 2008 16:40:01 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [212.17.241.230]) by mx1.freebsd.org (Postfix) with ESMTP id 61B758FC0A for ; Wed, 13 Aug 2008 16:40:00 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.1/8.14.1) with ESMTP id m7DGdVhM076207; Wed, 13 Aug 2008 18:39:41 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.1/8.14.1/Submit) id m7DGdTPs076206; Wed, 13 Aug 2008 18:39:29 +0200 (CEST) (envelope-from olli) Date: Wed, 13 Aug 2008 18:39:29 +0200 (CEST) Message-Id: <200808131639.m7DGdTPs076206@lurza.secnetix.de> From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG, ccowart@rescomp.berkeley.edu In-Reply-To: <20080809001423.GN71785@hal.rescomp.berkeley.edu> X-Newsgroups: list.freebsd-questions User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.2-STABLE-20070808 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Wed, 13 Aug 2008 18:39:44 +0200 (CEST) Cc: Subject: Re: Interpreting top, vmstat, and company X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@FreeBSD.ORG, ccowart@rescomp.berkeley.edu List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2008 16:40:01 -0000 Christopher Cowart wrote: > What is the difference between the SIZE and RES fields of top? These are the same as the "SIZ" and "RSS" columns in ps(1). The former is the total virtual size of the process, i.e. the sum of all pages mapped into the process. The latter is the part that is currently resident, i.e. in physical RAM. Therefore you have always SIZ >= RSS. If RSS is 0, it usually means that the process is completely swapped to disk. Note that *both* numbers include pages shared with other processes, such as text pages (that's executable code, not ASCII text) from binaries and libraries, and shared memory. > How does this work with a threaded program like apache? Multiple threads within the same process always share the memory. So, as far as the memory consumption is concerned, it doesn't matter at all if a process is threaded or not, and how many threads it contains. > Some sample top output on this host: > > Mem: 131M Active, 3754M Inact, 425M Wired, 177M Cache, 214M Buf, 3422M Free > Swap: 16G Total, 24K Used, 16G Free > [...] > PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND > 32361 root 1 96 0 106M 16604K select 2 0:02 0.00% httpd > 50687 www 1 20 0 106M 17196K lockf 0 0:01 0.00% httpd > > I'm having a hard time accounting for the 3.8GB of inactive memory That looks like you have really plenty of RAM. Basically those numbers mean this: 425 MB of RAM is wired memory. Most of this (maybe even all) belongs to the kernel. "Wired" means memory pages that are fixed in physical RAM. The kernel cannot be paged to disk (at least not in FreeBSD), so kernel memory is usually wired. 131 MB of RAM is actively being used by processes. Everything else is just different kinds of cache. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "Software gets slower faster than hardware gets faster." -- Niklaus Wirth