Swapping Questions

Tom Neff tneff at bfmny0.UU.NET
Sun Feb 18 12:04:15 AEST 1990


In article <1990Feb17.203445.12673 at virtech.uucp> cpcahil at virtech.UUCP (Conor P. Cahill) writes:
>  One of the places where you can get program placed onto the 
>swap device when they aren't being run by anybody anymore is if the program
>has the sticky bit set (a 't' in the others-execute slot on an ls -l
>listing, set by doing a chmod 1xxx on the file).  

On SV3.2 versions I've seen, you can also say

	chmod +t filename

and set the sticky (text) bit.  You must be super-user.

>If this is set the 
>text portion of the program will remain in memory (and be swapped out 
>to the swap device if they are no longer needed and the memory is needed
>for other stuff, never to be swapped in until they are needed).

Right, and the text bit is a great feature if you don't overuse it.  It
scores the biggest win on largish executables which you do have frequent
occasion to use interactively, like vi, less, mush, or perl.  The normal
latency hit of loading these big fellows is eliminated!  For perl
especially, the difference is enormous.  Setting sticky on that utility
basically saved it from uselessness at my site.

But the price is that everything sticky you load STAYS in memory (or
the swap area) until you remove it or reboot.  So you're cutting into
your cache.  It's a good idea to increase NBUFS and rebuild the kernel
to match your typical load of sticky programs, otherwise your cache
hit rate goes down noticeably.

So basically you can ask, Do I love utility X enough to want to spend
the RAM to keep it resident all the time barring swaps?  If YES, set it
sticky.  (Vi and less are natural candidates.)  If NO, don't bother.



More information about the Comp.unix.i386 mailing list