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.
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.
I am trying to utilize the idle cpu on my computer, I would like to make it so that I can run a program in the background that will not interfere with my normal use of the computer. This is similar to the folding@home project running in the background of a computer. Btw this program is a simple bash script that I want running in the background. I want it to have as much cpu devoted to it as possible. Meaning that I want my cpu to run at about 80-90% at all times without slowing down my system any more then normal use.
Create a new user and allow them a small amount of cpu time compared to the rest. I am not sure how to do this but I also know this is not utilizing idle cpu time but just reserving a specific amount of cpu
Setup the program to have one of the lowest priorities possible and this should make it wait if something else is trying to use the cpu, something like firefox or azureus
Any idea and comments on how to actually execute these solutions or any others would be greatly appreciated.
Running anything with no noticeable impact is difficult or impossible to achieve. No doubt your backgrounded program will use memory and probably a little IO from time to time, and that will inevitably affect other processes, although not by hogging the CPU.
The simplest thing is to run it in the background with a high nice setting. Using screen is a nice way as you can close the terminal and then re-attach to it later.
Allow me to disagree - in (at least one) other universe this concept is well understood. A few decades of history helps.
I had high hopes that CKRM would evolve to provide the controls (and measurements) needed. Unfortunately they got slapped down by the virtual server and cluster proponents - and the kernel devs in general.
Containers (and now cgroups) is a poor substitute, but will likely be the best you'll get for a while.
I happen to one of those that think that Linux has drifted away from its roots - even lost the plot in some ways ...
Where does this leave us? Is nice not doing everything it is presumed to be doing?
Is CKRM an alternative method of handling priorities in the kernel or something?
Please enlighten! (or provide a link to enlightenment... no, not DR17 :P)
There's a program called cpulimit which will limit a given PID to a given percentage of CPU use. Runs into trouble if your program forks and a different PID than you specified starts using the CPU though.
I do this quite a bit with video compression, h.264 is a bit of cpu hog, so I'll run it a nice 19 and it'll chug along in the background without bothering what I'm doing even if I have the h.264 compressor using all the cpus.
Thanks for the feedback syg00. Seems nice is quite basic. So, would the CKRM option appear next to anticipatory/deadline/cfq in the IO Schedulers section? Is nice directly connected with these schedulers or would a new piece of software have evolved to further control the new CKRM scheduler?
It's all rhetorical to me but it's nice to know these things (no pun intended)
CKRM is dead.
Those schedulers you mentioned are I/O schedulers, nothing (directly) to do with task dispatch (on a CPU).
Ingo has added some infrastructure to the CFS - group fair scheduling. Looks like it might do the job - I pulled 2.6.26-rc9 this afternoon and had a play. Done by UID it seems to be easy enough to utilise - using cgroups would be a bit messier. That (CGROUP_SCHED) is aimed more at non-desktop users I'd reckon - they would probably be looking to script it.