Limit CPU usage for a user in Ubuntu

5

1

I want to limit the percentage of CPU a user who ssh to my comp can use like say only 25% cpu usage at max. How do i do this in ubuntu ?

tapan

Posted 2011-02-17T17:36:40.643

Reputation: 918

Answers

4

I think you can't do that. What you can do is modifying priority for user. You can do that by editing file /etc/security/limits.conf:

john hard priority 20

Sets priority for john's processes to 20 (effective after next login). 20 is lowest priority.

This way john can use 100% of CPU, but if someone else needs it, other user will immediately get it, and john's tasks will wait (or actually slow down, not stop completely).

Olli

Posted 2011-02-17T17:36:40.643

Reputation: 6 704

effective after next login does that refer to next ssh login or next system reboot? – xxx374562 – 2018-10-23T01:08:29.683

Not exactly what i am looking for. But since the other thing can't be done, i guess i'll have to work with this. Thanks a lot :). – tapan – 2011-02-18T05:17:24.250