On Wed, Jun 13, 2012 at 9:22 AM, Jack Coats <[email protected]> wrote:
> I have typed my notes about Tilghman's presentation on swap on line.
> Look at the 'past presentations' section of nlug.org and the
> presentation is linked there.  I might post it the link and link to my
> python notes once they are done to the mailing list.

> https://sites.google.com/site/sycamoretechnology/linux-tips/nlug-swap

Let me fix up some things that aren't quite right.

Swap isn't where virtual memory lives; rather, it's an area which
allows physical memory to be extended.  It's somewhat difficult to put
into simple terms, because swap today isn't the same as what swap used
to be.  At one time, on some systems, your entire virtual memory was
available on disk, and only a subset of pages appeared in physical
memory, as they were needed.  Currently, virtual memory is an
abstract, and some areas of virtual memory may be neither in physical
memory, nor in swap, because they are unused.  Only parts of virtual
memory that are in use may appear in swap currently.

Physical memory may be used for both virtual memory, as well as
filesystem caching.  'Swappiness' is what controls how the kernel
manages how much of each is in physical memory (not as a direct
proportion, but rather as a metric to decide whether to dump cache or
swap a process out) when memory is requested but not immediately
available.  You can think of it as a percentage, in terms of:  when
the kernel needs memory, and physical memory is all in use, then the
kernel will swap a process out to disk (the swap area) N percent of
the time (where N is the current swappiness value).  [In actuality, it
is not this simple, because if filesystem cache gets very small, then
the kernel will thrash, and the kernel developers do a good job of
ensuring that that problem doesn't surface when swap is available.]

Also, 0 for the swappiness value is fine, as long as your processes in
total never allocate as much physical memory as you have.  If you're
running a very strict system, and memory leaks aren't an issue, you
can be perfectly fine with 0.  If you ever do run out of physical
memory for process space, with a swappiness value of 0, the dreaded
OOM killer will be used to free some space.  [Again, I'm
oversimplifying for comprehension.]

-Tilghman

-- 
You received this message because you are subscribed to the Google Groups 
"NLUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nlug-talk?hl=en

Reply via email to