Tuesday, September 15, 2015

Process priority:Nice & Renice

Knowing your Process priorities:

                 Linux systems have the capability to run many processes ("jobs") simultaneously this can slow down the speed of some high priority processes and result in poor performance

To avoid this, you can to prioritize processes which needed high CPU usage.

 NICE and RENICE utility in Linux is used to change the process priority.

  •          Nice command will launch a process with an user defined scheduling priority. 
  •           Renice command will modify the scheduling priority of a running process.
   
The process scheduling priority range is from -20 to 19.




-20 represents highest priority, and  of 19 represent least priority for a process.
By default when a process starts, it gets the default priority of 0.

 

Nice Number




1. Enter nice command $nice -15 sleep 252500 &
       the dash in front of the 15 does not represent a minus sign.
       -15 represents low priority  sleep (process) and & (bg)
 
To move the process to high priority you need to be root 
        Enter nice command $nice --10 sleep 252426 &

Change the nice Number  : renice 

 
 So If you want to change the process while it was running then you need to use the "renice" command.


      1. Enter nice command $nice sleep 12121 &
             you can see the sleep priority  10 for the PID 3065

      2.Enter the command $renice 15 -p 3065
                    this will change the piority from 10 to 15

 

No comments:

Post a Comment