Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-02-2009, 07:30 PM   #1
LQ Newbie
Registered: Jan 2007
Posts: 18

Rep: Reputation: 0
How to set mximum allowed CPU time for a process ?


I am trying to play Heroes Of Might and Magic III (under wine) and after some hours of play my system just rebooted.

I looked for the CPU temp and it was 46 C.
I know this game uses 100% CPU time, even though it gets more FPS than needed, and I think it over-heats my system.

Is there a way to tell my system that process 3851 can only have 25% CPU time and no more (like the task scheduler to suspend it 10 times per second for 75ms each and only let it run 25ms) ?

Simply setting the process to low priority would not help.

I think it would not be complicated to write a program that suspends and resumes a process many times per second, as long as you know the API. Has anyone had a need for something like this before ?

I have (Slackware) Linux 2.6.24 i686 AMD Sempron.

Thank you,
Timothy Madden
Old 02-04-2009, 05:25 AM   #2
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 17,248

Rep: Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640Reputation: 2640
Have a look at containers (cgroups).
Documented in the source tree.
Old 02-04-2009, 05:28 AM   #3
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96

46C isn't hot. To be honest, it's not even warm for a modern processor. As a data point, my Athlon box runs at about 45 degrees at idle, and can get up to 65 under load.
I'd be more inclined to think that you've got some dodgy RAM, or a failing power supply.

Old 02-05-2009, 07:27 PM   #4
LQ Newbie
Registered: Jan 2007
Posts: 18

Original Poster
Rep: Reputation: 0
Thank you for your answers.

How am I supposed to use cgroups ? There is no such command ...
I thought 46 deg. C are not much, but then again during the time my system rebooted, twice, maybe the cooler did its job.
And anyway Heroes III does take up 100% CPU time, as system information shows me, and I had no way to stop it.

Thank you,
Timothy Madden


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
How can I set CPU max % usage for a process ? lapin3000 Linux - Software 3 12-01-2007 08:51 PM
how to get the accumulate cpu time of a process chrislam Programming 1 10-14-2007 05:02 PM
Set Maximum allowed per-process timer george_7117 Programming 2 03-06-2007 08:25 PM
kjournald process consumed all CPU time tttx Linux - General 1 05-11-2005 04:28 PM
set time limit on allowed user in iptables? luap Linux - Networking 5 03-04-2003 11:55 PM > Forums > Linux Forums > Linux - Newbie

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

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