LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-19-2004, 09:33 AM   #1
podollb
Member
 
Registered: Oct 2003
Location: Grand Forks, ND
Distribution: Suse/Slackware/RH
Posts: 161

Rep: Reputation: 30
nice and renice (question)


I have been able to use 'nice' and 'renice' to set priorities of processes but I run into a few weird problems with 'renice'. When I start an application without 'nice' I get the default priority of 0 and when I manually set the priority using 'nice' it works fine. BUT when a process is already running (with either the default priority or the newly set one) I can't only renice to the current priority and lower. I get a permission denied if I try to go higher. I think this example will make it clear:

prompt> ./myscript1 &
prompt> nice 10 ./myscript2 &

Now if I want to change the first scripts priority to a lower one (like the second one) I can successfully do this: (for the sake of the example lets say the priority of myscript1 is 24106)

prompt> renice 10 24106
24106: old priority 0, new priority 10

And that works fine, so both are running at the lower priority of 10.
Now if I want to put them back to 0 or anything higher than 10 it always says permission denied:

prompt>renice 5 24106
renice: 24106: setpriority: Permission denied

But I can successfully set them to (the same or) lower priorities:

prompt>renice 10 24106
24106: old priority 10, new priority 10
prompt>renice 11 24106
24106: old priority 10, new priority 11
prompt>renice 10 24106
renice: 24106: setpriority: Permission denied

But then I am just getting stuck at lower priorities since now that I have dropped to 11 in the above example I can't get back up higher...
 
Old 10-19-2004, 10:06 AM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 77
I did a quick play at the command line myself, and it would appear that regular users cannot 'unnice' their own processes. I knew that reg users couldn't negative nice anything, but it seems odd that they cannot bring the priority back to the default of '0'.

Try as root and you can set them lower (higher?) again...
 
Old 10-19-2004, 10:33 AM   #3
podollb
Member
 
Registered: Oct 2003
Location: Grand Forks, ND
Distribution: Suse/Slackware/RH
Posts: 161

Original Poster
Rep: Reputation: 30
Well I can use root to do anything on my own systems, but if I had root access on the system in question I wouldn't worry about nice'ing anything as I wouldn't be nice. But it isn't my system so I don't have root... I too just thought it was odd that I coulded renice my processes (as long as I stayed over 0). There must be a reson for that though...
 
Old 10-19-2004, 10:37 AM   #4
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 77
I read both the man and info page for nice and renice and saw no mention of this behavior.
 
Old 10-19-2004, 10:49 AM   #5
podollb
Member
 
Registered: Oct 2003
Location: Grand Forks, ND
Distribution: Suse/Slackware/RH
Posts: 161

Original Poster
Rep: Reputation: 30
That is what prompted my question, I too read them and then was puzzled why I kept having the aforementioned problem. (so I guess the question still stands)
 
Old 10-19-2004, 12:58 PM   #6
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 77
Sorry man, I'm as flabbergasted as you

nice/renice are part of coreutils, which is distributed by the FSF, maybe that is your next place to look if you really want to get to the bottom of this.
 
Old 10-19-2004, 01:00 PM   #7
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
This is from a UNIX man page on renice....


Quote:
Altering Process Priority
Users other than the privileged user may only alter the
priority of processes they own, and can only monotonically
increase their "nice value" within the range 0 to 19. This
prevents overriding administrative fiats.

So once you've lowered the priority of a process, your screwed. Of course I'm assuming that nobody has re-written renice for Linux and we're all just using the UNIX version

Last edited by Hangdog42; 10-19-2004 at 01:02 PM.
 
Old 10-19-2004, 01:10 PM   #8
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 77
Good call. I read that paragraph paying close attention to "Users other than the privileged user may only alter the priority of processes they own" and selectively ignoring "and can only monotonically increase their "nice value""

<shrug>
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
nice / renice problem g-string 3 Linux - Software 2 09-16-2005 05:53 PM
nice / renice question Grobbendonk Linux - Newbie 5 08-13-2005 05:05 PM
nice/renice crashes programs make Mandriva 1 04-20-2005 04:03 AM
Nice and Renice KnightAzul Linux - General 1 09-17-2003 12:59 PM
"nice" vs "renice" Poetics Linux - Newbie 2 07-03-2003 05:20 AM


All times are GMT -5. The time now is 10:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration