SUMMARY: keeping processes in memory

From: Amanul Haque (xhaque@etnsed.COM)
Date: Tue Apr 27 1993 - 22:10:39 CDT

I had originally asked this group if there was a way to force a process to
stay in memory. The following were the most common replies

1) look up chmod(2) chmod(2) mlock(2) plock(2) in the man pages.
   It could be done using the sticky bits.

2) Read the manual for mlock(2), which should do what you want if a)
    the process is not too big (there is an undocumented limit to how
    much memory can be locked), and b) it can run setuid root.

3) I don't know if this can work for you (you might not have src)
but mlock(3) or madvise(3) MADV_WILLNEED can do want you want
from within a process.

4) when a process sits idle for > 20 seconds, it gets swapped out
(in 4.1.x). in solaris 2.x, this "dead wood timer" no longer
exists. you can increase the priority of the process, but
that won't keep it in memory.

you can turn off the deadwood swapper -- set maxslp to 255, using
adb, and no process will be swapped out after 20 seconds (or
any amount of idle time).

but you still need to worry about paging. a process can lose
pages if you run out of memory and it doesn't touch them
frequently. in general, if you want real-time behavior, run
solaris 2.x and use the real-time scheduling class, which
gets you these goodies. in solaris 1.x, you can use plock()
and mlock() as root, but be aware that these really make
"hard locks" on memory, and you can seriously degrade system
performance if you lock down too many pages

Have not had a chance to sort througgh all this mess. One of my users
asked me this question and have passed the answers to him. I do not
believe that he has had a chance to try some of the things you folks
suggested. Will let you know what happens.

Thanks to all those who replied.

Please do not send any flames. Several have already been sent suggesting that
I post similar requests to comp.sys.sun.apps. This posting is in reply to
several requests for summaries.

Amanul Haque                 :
Eaton Corporation            :      Trains stop at train stations;
Semiconductor Equipment Div. :      what happens at workstations ?
Austin, TX, USA              : 
VOICE (512) 873-2722	     :      What happens if you have more than
FAX   (512) 837-3691         :      one workstation ?            :

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:47 CDT