Whenever i run CPU/RAM intensive tasks, i cant use my computer it freezes until the task is complete. I was looking for a way to limit resources per process for all processes.
i.e so none of the processes pass above 25% CPU or 3gb RAM.
Thanks
Whenever i run CPU/RAM intensive tasks, i cant use my computer it freezes until the task is complete. I was looking for a way to limit resources per process for all processes.
i.e so none of the processes pass above 25% CPU or 3gb RAM.
Thanks
Limiting all processes to an arbitrary limit might not be as beneficial as you might initially think.
As a comment pointed out, you can limit the CPU,
but depending on the process, you might better be served by simply setting the
nice
-ness of the process (also known as process priority).
Doing this will allow the process to run at full speed when you're just reading a site and not using any CPU, but yield and give
way to your browser once it needs to start utilizing the CPU(s) for any JavaScript (as an example).
Another option is to set the CPU affinity of the process. This lets the OS only run the process on one specific CPU core, leaving the other 3 (in your case) free for anything else that might need it. This is nice when your process is a single-threaded process (like a video encoding process or source building process, for example); you can set the affinity to the 1st CPU core and you've got 3 others at idle (until used that is).
And there's also ulimit
, which you can use to set soft and hard limits or RAM/CPU (though this is
system wide and not per process).
It should be noted that limiting your RAM might have unintended consequences (like swap usage), and instead you should
try the nice
value, CPU affinity or ulimit
for CPU time before limiting the RAM. RAM is not like CPU in that more usage
of it will degrade overall system performance; on the contrary, system performance tends to increase when more RAM can be used
and you should only notice a performance decrease if swap area has to be used over RAM (since swap is usually disk based
and orders of magnitude slower than RAM), and if you notice a lot of swap area being used with a bunch of free RAM, then there's something else going on that needs to be addressed (like a kernel setting).
Hope that can help.