tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: POSIX threads scheduling policy/priority


Stathis Kamperis <> wrote:
> I've written a test case regarding POSIX threads scheduling policy &
> priority. The test is here:
> For some reason, I can't set the policy/priority of {hi, low}_thread
> from the main thread. In NetBSD 5.0_STABLE that is. The setter
> function report success, but the threads are born with the default
> values for their attributes. Linux fails as well, whereas Solaris 10 +
> dflybsd-current pass.

Scheduling attributes can be inherited (PTHREAD_INHERIT_SCHED) or set
explicitly (PTHREAD_EXPLICIT_SCHED), see pthread_attr_setinheritsched()
description.  POSIX allows any default, in NetBSD it's inherit.

Also, keep in mind that 0 and 1 priority values in your test case may not
necessary be valid priority numbers (although it is very unlikely).  It can
be any range, only required condition by POSIX is that it should provie at
least 32 levels.  To determine min/max, there are sched_get_priority_min()
and sched_get_priority_max() calls.


Home | Main Index | Thread Index | Old Index