Process priority in OSX?

Discussion in 'Mac Apps and Mac App Store' started by TheMonarch, May 11, 2005.

  1. TheMonarch macrumors 65816

    TheMonarch

    Joined:
    May 6, 2005
    Location:
    Bay Area
    #1
    Question! Is there a way to set the priority of a certain process in OSX? Whenever i'm rendering something in Final Cut Pro or any other program, it slows down the whole system (duh), but whenever i'm doing something under windows (rendering 3D or whatever) I can turn down the the priority in the task manager (where would windows be without CTRL+ALT+DELETE) so the whole system doesent slow down to a crawl and I can contunue to do other things while the system is busy rendering. I know it will take a little longer to render depending on whatever else im doing, but i hate slowdowns so much (especially a slow dock).

    Sometimes render times go on for hours and it wouldn't seem as painful if I was able to do other things without the WHOLE system being so slow.
     
  2. daveL macrumors 68020

    daveL

    Joined:
    Jun 18, 2003
    Location:
    Montana
    #2
    Use activity monitor to find the ProcessID of the process of interest, then use the 'renice' command in Terminal.

    "man renice":

    RENICE(8) BSD System Manager's Manual RENICE(8)

    NAME
    renice -- alter priority of running processes

    SYNOPSIS
    renice priority [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]
    renice -n increment [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]

    DESCRIPTION
    The renice utility alters the scheduling priority of one or more running
    processes. The following who parameters are interpreted as process ID's,
    process group ID's, user ID's or user names. The renice'ing of a process
    group causes all processes in the process group to have their scheduling
    priority altered. The renice'ing of a user causes all processes owned by
    the user to have their scheduling priority altered. By default, the pro-
    cesses to be affected are specified by their process ID's.

    The following options are available:

    -g Force who parameters to be interpreted as process group ID's.

    -n Instead of changing the specified processes to the given prior-
    ity, interpret the following argument as an increment to be
    applied to the current priority of each process.

    -u Force the who parameters to be interpreted as user names or user
    ID's.

    -p Reset the who interpretation to be (the default) process ID's.

    For example,

    renice +1 987 -u daemon root -p 32

    would change the priority of process ID's 987 and 32, and all processes
    owned by users daemon and root.

    Users other than the super-user may only alter the priority of processes
    they own, and can only monotonically increase their ``nice value'' within
    the range 0 to PRIO_MAX (20). (This prevents overriding administrative
    fiats.) The super-user may alter the priority of any process and set the
    priority to any value in the range PRIO_MIN (-20) to PRIO_MAX. Useful
    priorities are: 20 (the affected processes will run only when nothing
    else in the system wants to), 0 (the ``base'' scheduling priority), any-
    thing negative (to make things go very fast).
     
  3. iBunny macrumors 65816

    Joined:
    Apr 15, 2004
    #3
    So pretty much from the description above, their is no easy way like bringing up the task manager, right clicking and setting the priority.

    I read that ^ up their and am 100x more confused than I was before I read it.

    So I dont know what to do either.
     
  4. daveL macrumors 68020

    daveL

    Joined:
    Jun 18, 2003
    Location:
    Montana
    #4
    Basically, you find the process ID you're interested in via Activity Monitor or by running "ps Ac" in Terminal. I'm assuming that you want to change the priority of a process that's already running. Once you have the PID, then run "sudo renice -20 PID" from the Terminal. You have to have admin privileges to run this command, and you will have to enter your password. The "-20" sets the process priority to its highest value; you would use a priority of "20" to set it to its lowest value. I know this sounds backwards, but it's not.

    If you are starting a process from Terminal, use the "nice" command.

    You might want to look at "man setpriority" for additional information, although this is *not* a command, it's a system call, i.e. you would use it from within a program you are coding.
     
  5. bharris1 macrumors newbie

    Joined:
    May 7, 2010
    #5

Share This Page