Date: Wed, 13 Aug 2008 18:39:29 +0200 (CEST) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-questions@FreeBSD.ORG, ccowart@rescomp.berkeley.edu Subject: Re: Interpreting top, vmstat, and company Message-ID: <200808131639.m7DGdTPs076206@lurza.secnetix.de> In-Reply-To: <20080809001423.GN71785@hal.rescomp.berkeley.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808131639.m7DGdTPs076206>