[Gllug] Forcing CPU and Mem limits on a process
John Hearns
john.hearns at streamline-computing.com
Sun Feb 13 21:05:13 UTC 2005
On Sun, 2005-02-13 at 16:51 +0000, Nix wrote:
> On Fri, 11 Feb 2005, John Edwards wrote:
> > On Fri, Feb 11, 2005 at 01:50:26PM -0000, David Abbishaw wrote:
> >> Can anyone recommend how I can run a process and define that it can only
> >> use say 25% of the cpu and an amount of memory??? I thought nice would do
> >> the CPU but it doesnt look great.
> >
Your question makes me think of batch scheduling systems.
In a multiuser environment, you would think of using a resource
scheduling system like Gridengine http://gridengine.sunsource.net
You can set hard and soft limits for memory in Gridengine.
These are set by 'setrlimit' - so are the same limits other people in
the thread have referred to.
At the soft limit, the job is sent a signal, so the user code CAN trap
this and do something sensible before halting.
At the hard limit the job is killed.
The '25% of CPU' is an intriguing one.
I don't think it is possible looking at it with Gridengine eyes -
after all a scheduler is supposed to keep your cluster humming along
at maximum utilisation!
However, queues in Gridengine can have subservient queues, so that
(for instance) short test jobs can get priority over long running jobs.
The subservient queue jobs are suspended.
In combination with that, you can write your own 'load sensors'.
I GUESS that you might hack some sort of load sensor script to suspend
queues when CPU utilisation goes above 25%, but it would be against
nature :-)
Seriously though, if you are looking to limit TOTAL cpu usage,
rather than a percentage, then Gridengine is the tool for you.
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list