I would like to limit the number of CPU cores that a specific user can use at any single moment. How would I do this on Linux?
Asked
Active
Viewed 1,748 times
2
-
see https://unix.stackexchange.com/questions/326579/how-to-ensure-exclusive-cpu-availability-for-a-running-process ; however for very specific cases, like SSL frontends or wifi AP controllers, both with heavy load, the kernel most probably might be better taking decisions than you. – Rui F Ribeiro Jun 02 '17 at 08:47
1 Answers
0
From what i know, you cannot do that other than using docker as virtual environment and limiting entire container to selected cores. Example:
docker run --cpuset-cpus="0"
For most of the time you should not be forced to use such solution.
If one of the users causes problems use /etc/security/limits.conf
adding entry:
username - priority 19
That should make all of user's processes run with priority 19 (lowest) and thou even when consuming much of CPU it should not interfere with other programs on the machine.
Also, if it's a matter of single process (not user), then you can use nice
or cpulimit
/ cgroups

DevilaN
- 1,966