Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - nice(): (3 Items)
   
nice()  
According to POSIX, nice() has no effect for FIFO or round-robin
scheduling, and the effect is implementation-defined for other scheduling
algorithms.

Our version of nice() calls getpriority() and setpriority(), which both
return 0 and do nothing else.

According to POSIX, nice() is supposed to return the new nice value - NZERO, but our version always returns 0. I think 
this is correct because nice() isn't actually making the caller any more (or less) nice. Is this a valid interpretation?


There's a PR (# 10714) about changing the behaviour of nice(), but if we already comply to POSIX, I imagine we should 
mark this PR as "no intent to fix" and update our docs to say that nice() has no effect.

Any thoughts on this? Thanks.
Re: nice()  
The docs for a couple of UNIX-es i've looked up all say that nice() returns what we would call (post_nice_priority - 
original_priority). I.e a prio 10 thread that has had nice(1) and then nice(2) called on it will return 1 for the first 
nice() and 3 for the second. 

If that's the standard, we certainly dont support it, since we do no remember the "original" priority of a thread. 

I suspect the whole "nice" mechanism is predates the notion of priorites.

-ad
Re: nice()  
The nice() function and the command line utility in linux was rather
useful, but as mentioned, only usable with SCHED_OTHER (if memory serves
me right). The linux SCHED_OTHER scheduling policy was a fair share
scheduler with aging processes, so with the dynamic nature of
process/thread priorities it was quite handy.

I don't think the same idea is really applicable to hard real-time. I
wonder, does nice have any affect on sporadic scheduling and would my
computer explode if I tried such a thing?

Joel

On Mon, 2008-07-07 at 10:51 -0400, Attilla Danko wrote:
> The docs for a couple of UNIX-es i've looked up all say that nice() returns what we would call (post_nice_priority - 
original_priority). I.e a prio 10 thread that has had nice(1) and then nice(2) called on it will return 1 for the first 
nice() and 3 for the second. 
> 
> If that's the standard, we certainly dont support it, since we do no remember the "original" priority of a thread. 
> 
> I suspect the whole "nice" mechanism is predates the notion of priorites.
> 
> -ad
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post10118
>