Bug 38117

Summary: New FAQ entry for memory states
Product: Documentation Reporter: Norbert Papke <npapke>
Component: Books & ArticlesAssignee: Murray Stokely <murray>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Norbert Papke 2002-05-15 19:20:01 UTC
In a recent discussion on comp.unix.bsd.freebsd.misc John S. Dyson <dyson@iquest.net> provided the following excellent description of memory states.  It should be added to the FAQ, possibly in "Chapter 16 - Misc Questions".  I have checked with John and he does not object to his answers being used in this manner.

Q: What do the various memory states displayed by 'top' mean?

A: 

Active:  pages recently statistically used.

Inactive:  pages recently statistically unused.

Cache:  (most often) pages that have percolated from inactive to a
status where they maintain their data, but can often be immediately
reused (either with their old association, or reused with a new
association.)   There can be certain immediate transition from
active to 'cache' state if the page is known to be clean (unmodified),
but that transition is a matter of policy, depending upon the
algorithm choice of the VM system maintainer.

Free:  pages without data content, and can be immediately used in
certain circumstances where cache pages might be inelegible.   Free
pages can be reused at interrupt or process state.

Wired:  pages that are fixed into memory, usually for kernel purposes,
but also sometimes for special use in processes.

Pages are most often written to disk (sort of a VM sync) when they
are in the 'inactive' state, but 'active' pages can also be synced
also (but require s the availability of certain CPU features.) This
depends upon the CPU tracking of the 'modified' bit being available,
and in certain situations there can be an advantage for a block of
VM pages to be synced, whether they are active or inactive.  In
most common cases, it is best to think of the 'inactive' queue to
be a queue of relatively unused pages that might or might not be
in the process of being written to disk.  'Cached' pages are already
'synced', not mapped, but available for immediate process use with
their old association or with a new association.   Free pages are
available at interrupt level, but cached or free pages can be used
at process state for reuse .  Cache pages aren't adequately locked
to be available at interrupt level.

There are some other flags (e.g. Busy flag or busy count) that might
modify some of the rules that I described.

How-To-Repeat: n/a
Comment 1 Ceri Davies freebsd_committer freebsd_triage 2002-10-28 19:11:52 UTC
Responsible Changed
From-To: freebsd-doc->ceri

This has been overlooked for too long. 
Remind myself to do this.
Comment 2 Ceri Davies freebsd_committer freebsd_triage 2003-01-23 23:38:17 UTC
Responsible Changed
From-To: ceri->freebsd-doc

Throw this back to the doc team.
Comment 3 Murray Stokely freebsd_committer freebsd_triage 2003-05-04 23:29:01 UTC
Responsible Changed
From-To: freebsd-doc->murray

I will look at this one.  We should definitely add it to the FAQ.
Comment 4 Murray Stokely freebsd_committer freebsd_triage 2003-05-05 05:08:48 UTC
State Changed
From-To: open->closed

This change has been committed to the FAQ.  It may take up to 24 hours 
to reach the website.  Thanks very much for collecting this valuable 
usenet posting for us.