pinning a process in memory

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Sun Aug 12 13:22:51 UTC 2007


On Thu, Aug 09, 2007 at 02:13:46PM -0400, jing wrote:
> I have a dumb question which defeated my attempts at googling for an
> answer.  I know that there's a way to programmatically pin pages in
> memory through the mlock call, but I want to pin a process in memory
> from the command line.  Anyone know what the magical incantation is
> for this?
> 
> Simply turning off swap isn't an option since I want to swap some apps
> out.  I just want a specific app to always stay in memory no matter
> what.

I believe the answer is that you can't do it.  If a process wants to
avoid swapping, the programmer should call mlock or mlockall.  In
general the memory manager in linux is very good, and you should never
have any need to override it's behaviour.  You may want to tune some of
it's options for caching and such in /proc/sys.

--
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list