1819831 Members
2957 Online
109607 Solutions
New Discussion юеВ

Process Priority

 
Dean Wallis
New Member

Process Priority

I have been asked by a vendor to create a userid with a nice value in its .profile/.shrc which lets all processes started by that User run with a higher priority than the System Default.

Is that possible, I thought you have to be a root to change nice values

Does anyone have any ideas on the above.

Thanks

Dean
3 REPLIES 3
Michael Tully
Honored Contributor

Re: Process Priority

No, only root can increase the amount of CPU a process gets. Increasing the 'nice' value for a child process, results in less CPU usage.

From the 'nice' man page
Ordinary users can only increase the system nice value of any child process relative to the current process; i.e., priority_change must be a positive (unsigned) value, resulting in a lower priority. To start a child process at a lower system nice value (higher priority) than the current process, the user must have the appropriate privileges, regardless of the relative nice-priority value desired.

Regards
Michael
"When I have trouble spelling, it's called fat finger syndrome."
Anyone for a Mutiny ?
Jeff Schussele
Honored Contributor

Re: Process Priority

Hi Dean,

As Tully pointed out ONLY root can lower nice values which increases priority.
EVEN the owner of the proc can ONLY increase nice thusly decreasing priority.
I think I'd question the vendor as to *why* they feel their proc needs a lower nice value. My intuition is whispering to me..."Crappy throughput - sloppy code - let's disguise this fact".
The best you could do - and personnally I wouldn't w/o a VERY compelling reason - would be to have root start the proc using

nice --X /path/to/binary

where X=nice decrease from the default of 20. But then root would own the PID which could cause problems in & of itself.

My $0.02,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jeff Schussele
Honored Contributor

Re: Process Priority

Another question one should *think* about here is....

IF I legally cannot modify your code - why do you feel you think I should modify my environment in an obviously biased manner?

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!