linuxprocess-managementnicerenice

Set 'nice' value to concrete processes, by default


I would like to set specific "nice" values to several processes in a laptop. For example, I would like the window manager to run at -10, and keep the default at 0.

I know that "renice" can change the niceness of a processes, but this is a-posteriori, and I do not want to "renice" my window manager process every time that I open the computer. Similarly, "limits.conf" allows to specify default niceness for specific users or groups, but not (as far as I know) specific processes.

So my question is whether there is a way to define niceness for concrete processes, without having to change the default for the user and without having to renice the process once it runs.


Solution

  • Use nice(1) e.g.

     nice --5 x-window-manager
    

    or more commonly

     nice make -j 2
    

    You probably need root privileges to give an unnice adjustment (e.g. a negative one which raises the chance of being scheduled). See nice(2).

    See also ionice(1)