Swap usage discussion

Jerry Davis plug-devel@lists.PLUG.phoenix.az.us
Fri Jun 18 01:55:02 2004


On Friday 18 June 2004 01:46 am, Ted Gould wrote:
> On Thu, 2004-06-17 at 08:22, Alan Dayley wrote:
> > To my questions:
> > - What experience and "rules of thumb" are there that would answer this
> > question?
> > - What tools such as "top" and "free" can be used to analize memory, and
> > particularly, swap usage?
> > - Are there any other tips and pointers that can be provided to help my
> > quest?
>
> I don't really have any answers, but I'll throw in another variable.
> That would be, how active are the processes?  Because, if something gets
> swapped out, but never gets swapped back in, it will use the space
> allocated indefinitely.  In my experience as a user, it seems that Linux
> never swaps things back in even if the RAM frees up.  It only gets
> swapped back in when it is used.  But, that is just my impressions as a
> user.

Well it would seem to me that this is an oversimplification of the swapping 
algorithm. How does the swapping algorithm work on Linux?

I would think that the anything swapped out, would not be swapped back in 
unless it was 'touched', i.e. that particular data or code page was used 
again.

Lets say for instance you had a heavily used system. And you had a binary 
being time-sliced in, and it needed memory that wasn't there at the time, the 
least used (as far as time when used last) in theory would get swapped out to 
free up memory for the program needing it. If however, the code being swapped 
out is never to be used again (i.e. it happened to be init code), what would 
happen, would it stay there until the program needing it went away?

If I remember, swapping algorithms are complex.

Just musing here
Jerry

>
> 		--Ted

-- 
Registered Linux User: 275424
Today's Fortune: Marriage is an institution in which two undertake to become 
one, and one
undertakes to become nothing.