8 Replies Latest reply: Apr 22, 2008 2:01 PM by JeffCMKRNL
JeffCMKRNL Level 1 Level 1 (10 points)
How can I change the cpu priority of a process?
I could not find a way to do this using the Activity Monitor. How about a command using the terminal app?
When I am using Handbrake, I would like to lower its process priority to compute in the background.

Thank you in advance.

Dual PowerMAC G5, G5 Mac Mini, CoreDuo MacBook, Mac OS X (10.4.9)
  • BDAqua Level 10 Level 10 (120,675 points)
    Hi Jeff,

    Just do a...

    man nice

    in Terminal, and note how it's backwards... minus is faster, plus is slower.
  • JeffCMKRNL Level 1 Level 1 (10 points)
    That looks like what I am looking for.
    I tried it but I could not get it to work. I think it is because of the "utility" argument. At first I used the path to the handbrake application. This is what I tried and the error I received:
    Arakis:~ jeff$ nice 10 /Applications/HandBrake/HandBrake.app
    nice: 10: No such file or directory
    What is meant by the "utility" argument?
  • BDAqua Level 10 Level 10 (120,675 points)
    Just type that nice 10 with a space after it, then drag handbrake from a finder window to the Terminal window... see if that works better.
  • carillonator Level 1 Level 1 (0 points)
    you have to refer to the process by its ID. Go to the Activity Monitor (Apps>Utilities) and find handbrake and its ID. Use renice to re-prioritize an already-running process--nice is to start the process from the terminal.

    To set it to its lowest priority:

    sudo renice 20 2933

    where 2933 is the process' ID (change it to yours). 0 priority is default, -20 is highest.
  • Chris CA Level 9 Level 9 (77,970 points)
    This -> Renicer seems to work okay. I haven't had any problems with 10.4.11.
  • JeffCMKRNL Level 1 Level 1 (10 points)
    That is exactly how I did it. I did have a space after the 10, and I dragged the application to the terminal window, and it responded with the "Not found" error message.

    I will try the renice when I get home tonight. At work I am using Windows 2000 and Lotus notes (AAAArrrrgh!). I also support 4 PDP-11s and 6 antique VAX systems and an old Stratus.

    I have renamed the title of my position to "Paleocybernetic Systems Administrator".
  • polyglotinc Level 1 Level 1 (10 points)
    I tried this and it did not complain with an error message but I see no evidence via Activity Monitor that it did anything!

    I am still seeing 0% Nice CPU in the CPU tab of Activity Monitor
    and Handbrake is still using 150% of CPU (I guess this is possible because of dual core CPU).

    How do we know that the renice did anything?
  • JeffCMKRNL Level 1 Level 1 (10 points)
    Well, I think it worked, but I'm not seeing the processing being registered as "nice" cpu usage, so I am not sure.

    I could not find a way in the activity monitor to display process priority. Is there a way to view the current priority either in Activity Monitor, or in Terminal?

    Jeff