[Gllug] Forcing CPU and Mem limits on a process

Nix nix at esperi.org.uk
Sun Feb 13 16:51:53 UTC 2005


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.
> 
> Limiting memory is straight forward - look at the "ulimit" command 
> in the bash manpage.

However, note that if you set any stack limits, you can expect NPTL to
fail, which means that threaded programs will keel over in a heap.

(This is probably a kernel bug: I think it's not catering for the case
of multiple discontiguous stacks properly.)

> I don't think the Linux task scheduler can limit CPU usage to a 
> percentage.

At the request of the audio guys, this is coming (maybe in) 2.6.11, but
as usual it'll be some time before the userspace tools catch up.

-- 
Synapsids unite! You have nothing to lose but your eggshells!
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list