LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-26-2009, 05:24 PM   #1
dellthinker
Member
 
Registered: Jan 2007
Distribution: Debian
Posts: 217

Rep: Reputation: 30
Throttle CPU


Hi all, i know about bandwidth throttling, but i've never heard anyone ever throttling a cpu. I was wondering if it was possible. I have a perl program that tends to eat up the cpu bandwidth by like %34.50. Seeing how my machine is a 1.8GHz Pentium, it does have its limits. So does anyone have any useful solutions to my problem? Thanx in advance!
 
Old 06-26-2009, 05:55 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,194

Rep: Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040
nice

It's a command called nice.

jlinkels
 
Old 06-26-2009, 06:11 PM   #3
dellthinker
Member
 
Registered: Jan 2007
Distribution: Debian
Posts: 217

Original Poster
Rep: Reputation: 30
Can you give me an example on how to use it, i cant find any even with Google.
 
Old 06-26-2009, 07:34 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,194

Rep: Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040Reputation: 1040
No, I can image if you google for "nice" that should yield 2e15 unusable results.

This is the man page: http://www.manpagez.com/man/1/nice/

And you use it like:
Code:
nice 40 myperlprogram
It will schedule your progam below most others, the higher the nice value, the nicer your program behaves.

But ...uhm.... it doesn't make your processor run slower when your program is the only one to run. Running any program requesting full power will increase the clock speed.

It will be difficult to achieve that as all power saving schemes are based on gives you as much CPU power as possible when you need it.

You might want to check settings of powernowd, and see if you can make it stick at a low CPU MHz value. Certainly you will google useful results, and also check "CPU clock throttling". A lot of sites will direct you to the speedstep.c program but I am not sure you are willing to recomplie your kernel for this, and it will be difficult you make your CPU listen to full power again. There might be an entry in /proc/sys/cpu which allows you to limit the clock speed as well.

jlinkels
 
Old 06-26-2009, 08:28 PM   #5
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
Why/when do you want to "throttle" the CPU? It means enough different things depending on the purpose that we can't really give you a good answer without guessing/assuming what you really want (though the earlier answers might include the correct assumptions).

Usually people want to reduce the CPU usage of some task in order to make concurrent tasks run faster. That is what "nice" and related tools for manipulating process priority take care of.

Maybe you want to reduce CPU usage to reduce power consumption or heat generation. That is the purpose of tools like powernop, but those are biased toward only reducing the CPU speed when it isn't used much, even by low priority processes. Making that mechanism reduce the CPU available to the process you want to throttle, would be possible, but more difficult than the ordinary use of powernop.

Maybe you want to test a program to see how it would run with a less powerful CPU. There are ways to do that as well, but I don't want to guess that is what you mean.

So our best answer to "how" depends on your answer to "why" and maybe "when".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ACPI temperature reading makes my CPU throttle uraldinho Linux - Laptop and Netbook 6 08-26-2008 11:25 PM
Throttle Apache dellthinker Linux - Server 1 01-30-2008 10:36 AM
how do you throttle bandwidth? wincen Linux - Networking 1 05-15-2005 12:58 PM
Full throttle cpu? corbintechboy Mandriva 1 10-03-2003 08:28 AM
How To throttle Pop3?? Andrea Linux - Networking 3 07-21-2001 01:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration