svn commit: r219003 - head/usr.bin/nice
jhb at freebsd.org
Thu Feb 24 19:37:55 UTC 2011
On Thursday, February 24, 2011 2:03:33 pm Remko Lodder wrote:
> On Feb 24, 2011, at 7:47 PM, John Baldwin wrote:
> > Are you sure that this statement applies to both ULE and 4BSD? The two
> > schedulers treat nice values a bit differently.
> No I am not sure that the statement applies, given your response I understand
> that both schedulers work differently. Can you or David tell me what the difference
> is so that I can properly document it? I thought that the tool is doin the same for all
> schedulers, but that the backend might treat it differently.
In the case of ULE, ULE decides first if you are interactive or not. If a
thread is interactive, nice is completely ignored. For non-interactive
threads, ULE computes a priority based on how CPU hoggish the thread is.
The nice value is then added to that priority. Thus, a nice value applied
to a slightly hoggish process might still end up with a lower priority value
(and thus "more" important) than a very hoggish process with a nice value of
In 4BSD it is somewhat similar in that when you sleep on a socket ('sbwait')
or select, etc. in the kernel, the nice value is effectively ignored. 4BSD
relies on the priority values passed to tsleep(), etc. to mark interactive
processes whereas ULE uses its own set of heuristics. The effect though is
that nice is also ignored for interactive processes under 4BSD and is then
added to the resulting 'user priority' (which for 4BSD is always based on
how CPU hoggish a process is). I think for 4BSD it might be true that certain
nice values will never yield to certain other nice values, but I'm not sure
that '0' and '19' are the right numbers there.
More information about the svn-src-all