CPU usage limiter under Linux

Message boards : Number crunching : CPU usage limiter under Linux
Message board moderation

To post messages, you must log in.

AuthorMessage
jombo

Send message
Joined: 19 Jun 05
Posts: 9
Credit: 507
RAC: 0
Italy
Message 126243 - Posted: 22 Jun 2005, 1:27:07 UTC

Since this functionality is not supported by kernel, I wrote a simple C program to set an upper limit to cpu usage of a process, known the name of executable file.
Its purpose is similar to ThreadMaster service for Windows, though with different mechanisms.

It could be nice if it was downloadable from add-on software page (http://setiathome.berkeley.edu/download_network.php).

Anyone interested to it?
ID: 126243 · Report as offensive
jrmm22
Volunteer tester

Send message
Joined: 30 Jan 04
Posts: 353
Credit: 24,536,157
RAC: 0
United States
Message 126328 - Posted: 22 Jun 2005, 5:22:54 UTC - in response to Message 126243.  

Since this functionality is not supported by kernel, I wrote a simple C program to set an upper limit to cpu usage of a process, known the name of executable file.
Its purpose is similar to ThreadMaster service for Windows, though with different mechanisms.

It could be nice if it was downloadable from add-on software page (http://setiathome.berkeley.edu/download_network.php).

Anyone interested to it?


Sure, I'll give it a try...
Designed to work on any kernel?

ID: 126328 · Report as offensive
Ned Slider

Send message
Joined: 12 Oct 01
Posts: 668
Credit: 4,375,315
RAC: 0
United Kingdom
Message 126344 - Posted: 22 Jun 2005, 6:54:46 UTC

Hi Jombo,

This indeed is useful. I was recently looking for a similar thing for my laptop as it gets a little too hot crunching 24/7 over the summer. I thought of the possibility of writing a script to constantly start and stop the client allowing some cool down time but that was far too messy. In the end I was able to limit processor usage by setting the CPU throttling in ACPI but of course this is only possible on mobile chips. I found knocking the CPU back about 10% (to 90%) was enough to keep it a few degrees cooler during summer whereas otherwise I would have probably turned off seti completely during the hot months.

I was always surprised that this functionality was not present in the kernel, so this will be a useful utility :)

Regards,

Ned

*** My Guide to Compiling Optimised BOINC and SETI Clients ***
*** Download Optimised BOINC and SETI Clients for Linux Here ***
ID: 126344 · Report as offensive
Profile Paul D. Buck
Volunteer tester

Send message
Joined: 19 Jul 00
Posts: 3898
Credit: 1,158,042
RAC: 0
United States
Message 126415 - Posted: 22 Jun 2005, 13:38:56 UTC - in response to Message 126243.  

Since this functionality is not supported by kernel, I wrote a simple C program to set an upper limit to cpu usage of a process, known the name of executable file.
Its purpose is similar to ThreadMaster service for Windows, though with different mechanisms.

It could be nice if it was downloadable from add-on software page (http://setiathome.berkeley.edu/download_network.php).

Anyone interested to it?

Put a message up on developers mailing list or e-mail Dr. Anderson directly ...
ID: 126415 · Report as offensive
jombo

Send message
Joined: 19 Jun 05
Posts: 9
Credit: 507
RAC: 0
Italy
Message 126480 - Posted: 22 Jun 2005, 20:16:26 UTC - in response to Message 126328.  


Sure, I'll give it a try...
Designed to work on any kernel?


It should run on any OS supporting /proc filesystem and POSIX signals, so i suppose that every Linux it's ok.
Here is the code of the first (very rudimental!) version. Now it's much more powerful and precise.


I was always surprised that this functionality was not present in the kernel, so this will be a useful utility

You shouldn't be suprised, because implementing this limit in kernel process scheduling is a known hard problem, and would affect system performances.
In fact, my approach is different: I quickly suspend and resume controlled process so it can't use more than a fixed percentage of cpu time.


Put a message up on developers mailing list or e-mail Dr. Anderson directly ...


Ok, do you have his email address?
ID: 126480 · Report as offensive
jombo

Send message
Joined: 19 Jun 05
Posts: 9
Credit: 507
RAC: 0
Italy
Message 127385 - Posted: 24 Jun 2005, 17:05:46 UTC

Finally I have published my first version of cpulimit.

Go here to download it!

Please send me your feedback.
ID: 127385 · Report as offensive
[AF>Linux]Arnaud
Volunteer tester

Send message
Joined: 3 Apr 99
Posts: 70
Credit: 4,852
RAC: 0
France
Message 127922 - Posted: 25 Jun 2005, 19:40:47 UTC

Hi,
I tested it, and it works OK.
But how do you limit your CPU when you run several projects (they're changing every hour in BOINC). Do you open several Konsole windows and write:
./cpulimit ~/BOINC/projects/einstein.phys.uwm.edu/einstein_4.80_i686-pc-linux-gnu 50
./cpulimit ~/BOINC/projects/climateprediction.net/hadsm3_4.13_i686-pc-linux-gnu 50

when you run E@H and CPDN for exemple ?
Thanks.


Arnaud
ID: 127922 · Report as offensive
jombo

Send message
Joined: 19 Jun 05
Posts: 9
Credit: 507
RAC: 0
Italy
Message 128035 - Posted: 26 Jun 2005, 3:07:10 UTC


But how do you limit your CPU when you run several projects (they're changing every hour in BOINC). Do you open several Konsole windows and write:
./cpulimit ~/BOINC/projects/einstein.phys.uwm.edu/einstein_4.80_i686-pc-linux-gnu 50
./cpulimit ~/BOINC/projects/climateprediction.net/hadsm3_4.13_i686-pc-linux-gnu 50



yes actually it's the only way (note: writing executable file name is enough)

now cpulimit is only a foregroung program that control one process and has just the functionality.
but in the future it might become an advanced daemon with a configuration file where to specify several tasks and relative limits...

thanks Arnaud, and stay tuned!
ID: 128035 · Report as offensive
[AF>Linux]Arnaud
Volunteer tester

Send message
Joined: 3 Apr 99
Posts: 70
Credit: 4,852
RAC: 0
France
Message 128074 - Posted: 26 Jun 2005, 7:34:17 UTC

Ok, thanks for your reply
Arnaud
ID: 128074 · Report as offensive

Message boards : Number crunching : CPU usage limiter under Linux


 
©2024 University of California
 
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.