Pages

Sunday, April 16, 2017

What is Nice and Renice

With the help of Nice and Renice we can alter the priority of a process. Users other than the root can only alter the priority of the processes which they own, within the range 0 to 20. root user can alter the priority of any process and set the priority to any value in the range -20 to +20.  In Simple anything negative will make things go very fast.

To check the nice value of running process execute

ps -al - Nice value is listed under the column heading "NI”

Values of Nice and Renice : -20 to 19 and Default Value is 0. 

Least nice value : (-20) is highest priority 

Most nice value : (19) is lowest priority.

Launching a program with Priority 

nice -n <nice value> <command/Process>

Changing the priority of a running process

(i) To change the nice value for a particular process.

renice -n <nice value> -P <PID>

(ii) To change the nice value for all the process owned by a particular user/group.

# renice -n <nice value> -U <UserName>
# renice -n <nice value> -g <GroupName>

How to check the nice value of  a process

# ps -eo pid,user,nice,command (or) top

In top command filed NI will give the niceness value.

No comments:

Post a Comment