how to forbid a process to use swap?

Ben Cottrell tamino at wolfhut.org
Sun Mar 10 00:07:49 UTC 2013


On Mar 9, 2013, at 15:55, Anton Shterenlikht <mexas at bristol.ac.uk> wrote:
> I run a program that uses large arrays.
> I don't want it to use swap, because it's
> too slow. I want the program to fail when
> there's not enough RAM, rather than using
> swap. How to do this?

If it were me I would start with mlockall() and work from there...
do you have source code to the program in question?

You could also play with resource limits, just from the shell
(ulimit in sh, limit in csh) -- but that's less of an exact
science, since you don't *know* for sure how much memory the
process will be able to use before swap starts being used.

	~Ben


More information about the freebsd-questions mailing list