Inactive memory

Erik Trulsson ertr1013 at student.uu.se
Tue Feb 8 16:09:24 PST 2005


On Tue, Feb 08, 2005 at 05:55:26PM -0500, Chuck Swiger wrote:
> Erik Trulsson wrote:
> >On Tue, Feb 08, 2005 at 02:44:39PM -0700, Pat Maddox wrote:
> >Memory normally moves along the following path:
> >
> >Wired -> Active -> Inactive -> Cached -> Free
> >
> >and then when it gets allocated and used it moves back to Wired.
> 
> This is not exactly accurate: Active -> Inactive -> Free is better, with 
> Wired and Cached being mostly seperate categories.

Active -> Inactive -> Cached -> Free
is correct as far as I can tell.
Wired might be separate, I am not 100% sure what goes there.

> 
> >The difference between the categories is mainly that "Inactive" and
> >"Cached" memory still contains data that the system might be able to
> >reuse, while "Free" memory is completely free and unused.
> >In order to use Cached or Inactive memory it might need to be flushed
> >first, with Inactive probably being dirty and Cached probably not.
> >("Active" memory is almost certainly dirty and is therefore somewhat
> >more expensive to reuse.
> 
> Wired memory is typically the kernel text (executable code), any kernel 
> modules which have been loaded, and dynamic kernel memory used for critical 
> structures like the process table, descriptor table, VM page tables, which 
> tend to be staticly allocated.  The pager never touches these, they are 
> always resident in RAM.

Considering that the amount of memory in the "Wired" state tends to
vary quite a bit as the system runs it is certainly not all statically
allocated. (On my system "Wired" memory is usually about 15MB right after
booting, can go as high as 40MB, but usually hovers around 30 MB, and
almost never goes below 25MB after the system has been in use for some
time.)

> 
> More dynamic kernel data structures like the I/O buffer used for disk 
> access, network buffers, and the like are also wired down, but the system 
> will adjust the size and flush pages of data from open files and the like 
> to disk depending on the situation.  That pool of memory is the Cached 
> category.

No, that is not Cached memory.  It might be "Buffered", but I am not
sure exactly what goes in that category (it is however the only
category whose size do not fluctuate as time passes.)


> 
> The set of pages which have been accessed by processes "very recently" in 
> the Active category.  It includes dirty regions as well as program 
> executable code (which are not dirty).

True.


I based my explanation on the documents found at
 http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/vm.html
and at  http://www.daemonnews.org/200001/freebsd_vm.html



-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list