Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > General Help
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.

General Help
All your general support questions for Ubuntu, Kubuntu, Edubuntu and Xubuntu.

 
Thread Tools Display Modes
Old August 15th, 2006   #1
Lunar_Lamp
Quad Shot of Ubuntu
 
Lunar_Lamp's Avatar
 
Join Date: May 2006
Beans: 414
Ubuntu 6.10 Edgy
Limit CPU usage of process

I wrote a script to convert a few thousand music files from one file to another, and have started it going and don't want to stop it now really. However, after leaving it running for a while I realise that I forgot to start it with the 'nice' command, to make it have a low priority on CPU usage. Is there a way to lower a processes priority once it has started?

The script uses lots of sequential ffmpeg instances, and each one has a different PID, so I suspect this may not be possible. Also, would the 'nice' command have done what I wanted it to do seeing as the script itself doesn't do much, other that tell ffmpeg which files to convert. That is, it's ffmpeg that is using the resources. Or does 'nice' make all the children of a script have the same priority as the parent process?

Last edited by Lunar_Lamp; August 15th, 2006 at 06:13 AM..
Lunar_Lamp is offline   Reply With Quote
Old August 15th, 2006   #2
David Corrales
Quad Shot of Ubuntu
 
Join Date: Feb 2006
Location: San José, Costa Rica
Beans: 456
Ubuntu Jaunty Jackalope (testing)
Re: Limit CPU usage of process

You can use the command renice to dinamically assign a new nice value to a running process.
You can define process groups to alter a whole bunch of processes at the same time. Check the docs typing man renice
David Corrales is offline   Reply With Quote
Old August 15th, 2006   #3
brundles
A Carafe of Ubuntu
 
Join Date: Aug 2006
Location: UK
Beans: 100
Ubuntu 9.10 Karmic Koala
Re: Limit CPU usage of process

I think (but don't quote me!) that if you assign a nice value to a process any child processes from that are given the same nice value. i.e. If you renice the original script process then everytime that starts off the next ffmpeg instance that should have the same nice value.
brundles is offline   Reply With Quote
Old August 15th, 2006   #4
Lunar_Lamp
Quad Shot of Ubuntu
 
Lunar_Lamp's Avatar
 
Join Date: May 2006
Beans: 414
Ubuntu 6.10 Edgy
Re: Limit CPU usage of process

Thanks a lot!
Lunar_Lamp is offline   Reply With Quote
Old October 2nd, 2007   #5
metroplex
5 Cups of Ubuntu
 
metroplex's Avatar
 
Join Date: Oct 2006
Location: Sweden
Beans: 12
Ubuntu 7.04 Feisty Fawn
Re: Limit CPU usage of process

I'd suggest using the utility 'cpulimit'.

sudo apt-get install cpulimit
man cpulimit
metroplex is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:34 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry