Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a debian machine at home, and i have given someone an account on there, to do whatever they like with.
However, i would like to restrict them to only have the ability to use 25% of my CPU. They can run stuff at whatever priority they like, and as many processes as they like, but as an absolute maximum, they can only occupy 25% of my CPU.
I know you say that you'd like to have anything running at what ever priority the person wants but I'd say that the best way to do this would be to use the nice command to set the priority of the program
man renice and man nice should help, renice has the ability to apply a nice value to a program after it has been launched, so a shell script might come in handy.
We use this on a commercial shell server that we run, we haven't found the best way to restrict to the % of the CPU, I still say even if we did I would choose something like nice because sometimes processes spike to say 30% for a second or two while they do something intense, if the process was limited then maybe it might have problems or something.
the actual process in question is DNET. This doesn't spike, and even if it did, it shouldn't matter, cos it'd just be like it was running on a CPU that was 25% the speed!
Also... the nice value is useful, but it doesn't restrict a process to a percentage of the CPU... it just sets it's processor scheduling priority. If the machine is completely idle except for dnet, it would still run at about 100%. I want it to run at a maximum of 25%.
it's not about DNET specifically, it's about any process.... in fact, what i want to do is restrict a particular user to only being able to use 25% of the CPU at any one time.
I'm pretty sure there's a program out there to do this, but i just don't know it's name...
Things that may be done if I have spare time or enough encouragement:
Patch for limiting CPU usage for a given process group.
Patch for limiting CPU usage for a given user.
so, we all have ideas that kind of go around it, but not quite there. So for now, I guess you can monitor this users activities and use unSpawn's posted proggy to slow down the really heavy ones.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.