Operating System - HP-UX
1827384 Members
3946 Online
109963 Solutions
New Discussion

Re: Changing the priority of process with nice

 
SOLVED
Go to solution
panks
Regular Advisor

Changing the priority of process with nice

Hi All,

Currently my process is running with PID 27556. I want this process to run at highest priority.
How can I change the priority of this process to run at highest priority.
Also, how can I check the existing priority of the process.

Thanks
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: Changing the priority of process with nice

From the man page on nice:

A negative value requires superuser privileges, and assigns a lower system nice value (higher priority) to command.

To see existing priority, run "ps -l"


Pete

Pete
Jeff_Traigle
Honored Contributor
Solution

Re: Changing the priority of process with nice

This will show you the process information including nice value in the 8th column:

ps -el | grep 27556

You must be root to set the nice value less than what it's currently running at. See the renice man page. Nice value can range from 0 to 39 so, assuming you're root and the process is running with nice value of 20 (the default), the following would change it to the highest priority (lowest nice value):

renice -n -20 27556
--
Jeff Traigle
Bill Hassell
Honored Contributor

Re: Changing the priority of process with nice

Whatever you do, do not use rtprio to change priority. While this will give the highest priority, if your program was not designed for real-time priority, it will lock up your system so that almost nothing runs, including logins and root commands.

Also, priority affects CPU usage and will virtually no effect if your program is accessing the disk a lot. The only way to improve a program that needs a lot of disk I/O is to add a new disk onto another I/O card and move all the data to the new disk.


Bill Hassell, sysadmin
panks
Regular Advisor

Re: Changing the priority of process with nice

Found solution !!
Jeeshan
Honored Contributor

Re: Changing the priority of process with nice

the nice value is controlled by the user or administrator. The default value is 20.
(users can only lower their priority).

The priority is controlled by the system and depends on the nice value, duration, cpu usage, .... You can only influence this by reniceing the process or with rtprio.

first check with ps commands to determine the nice numbers under NI column
#ps -efl|cut -c 1-37,101-150

then ise renice value for the running processes

#renice -n
a warrior never quits