linuxmemoryprocessmemory-managementcpu-usage

Limiting process memory/CPU usage on linux


I know we can adjust scheduling priority by using the nice command.

However, the man page doesn't say whether it will limit both CPU and memory or only CPU (and in any case, it can't be used to specify absolute limits).

Is there a way to run a process and limit its memory usage to say "X" MB and CPU usage to say "Y" Mhz in Linux?


Solution

  • You might want to investigate cgroups as well as the older (obsolete) ulimit.