[ale] top and SWAP

JK jknapka at kneuro.net
Fri Sep 7 11:05:22 EDT 2007


JK wrote:

> John Wells wrote:
> 
>> Guys,
>>
>> Would like some help in clarifying the SWAP column under top
> 
> 
> I believe (based on knowledge of the 2.4 series kernels) that
> this reflects the amount of virtual memory owned by the process
> whose backing store is the swap partition.  However, just because
> a memory region is backed by swap does not mean it will ever
> actually be *written out* to disk.  The "Used" number is the
> amount of swap space actually in use on the disk.  If a swapped
> region is never actually written to (a situation that is quite
> common),

To clarify here: "written to" means "has some non-zero data
stored in the page". It has nothing to do with writing anything
to disk.  IOW, an anonymous (malloc'd) page whose contents
are never *changed* by the owning program will never be
physically realized in any way whatsoever.  If the process
accesses the page in a read-only manner, the OS satisfies those
read requests from a *single*, permanently-resident "anonymous
zero page".  Only if the process changes that data will a
physical RAM page be allocated (and possibly written to swap).

-- JK

-- 
"What can be asserted without evidence can also be
dismissed without evidence." -- Christopher Hitchens



More information about the Ale mailing list