Limit a process's relative (not absolute) processor consumption in Linux

Posted by BobBanana on Server Fault See other posts from Server Fault or by BobBanana
Published on 2010-06-06T01:13:28Z Indexed on 2010/06/06 1:23 UTC
Read the original article Hit count: 211

What is the standard way in Linux to enforce a system policy to limit the relative CPU use of a single process? That is, on a quad-core machine, I never want a process to use more than 2 CPUs at once, even if the process creates more threads. I do not want an absolute time limit, just a relative limit so that one task cannot dominate the machine. This is also different than renice, which allows a process to use all the resources but just politely step aside if others need them too.

ulimit is the usual resource limiting tool, but it does not allow such CPU restrictions.. it can limit the number of processes per user, or absolute CPU time, not restrict the maximum number of active threads of a single process.

I've found a couple of user-level tools, like CPUlimit, but not a system level tool or setting. Does such a standard resource controller exist in Linux (Red Hat Enterprise, if it matters.) If there is such a limit imposed, how would a user identify it?

© Server Fault or respective owner

Related posts about linux

Related posts about sysadmin