Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 08 Jul 2003 23:21:00 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        threads@FreeBSD.org
Subject:   Re: libc_r silliness
Message-ID:  <3F0BB44C.FB24CBE5@mindspring.com>
References:  <Pine.GSO.4.10.10307071543570.15065-100000@pcnet5.pcnet.com> <3F0A9E8E.99CA9BD@mindspring.com> <200307080923.20011.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote:
> On Tuesday 08 July 2003 06:35 am, Terry Lambert wrote:
> > > I have not found anything yet regarding sched_get_priority_{min,max}
> > > confusion in the POSIX spec...
> >
> > http://www.opengroup.org/onlinepubs/007904975/functions/sched_get_priority_
> >max.html
> >
> > The functions take a policy parameter; they are supposed to
> > return "appropriate" values, which I took to mean "appropriate
> > to the policy parameter supplied at the time they were called":
> 
> Yes, but in a multithreaded program when I call
> sched_get_priority_max(SCHED_RR), does that tell me the maximum process
> SCHED_RR priority for use with sched_setschedparam() or does it tell me the
> maximum thread SCHED_RR priority for use with pthread_setschedparam()?

The functions sched_getparam(), sched_setparam() are listed as
cross-references, while pthread_setschedparam() is not.

It's probably also useful to look at the pthread_setschedparam()
cross-references, which include pthread_setschedprio().  The page
for that function contains a rationale section, and references the
System Interfaces, Section 2, bsection "Scheduling Policies":

<http://www.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_08.html#tag_02_08_04_01>;

It specifically states that there shall be a minimum specified, but
that the maximum is implementation defined.  This reinforces the
idea that sched_get_priority_max() is meaningful to sched_* functions,
but not in pthread_* functions.

I suppose if you wanted to get technical on meaning, you could *maybe*
interpret the results in the context of whether or not the calling
thread was "scope process" or "scope system", and return a meaningful
value under those circumstances.  Of course, that would be evil.  8-).

Personally, I would note that the extension sections the set commands
are located in are disjoint, and that you are probably in territory
that's, at best, "implementation defined", when it comes to trying to
find allowable argument values for pthread_setschedparam().

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F0BB44C.FB24CBE5>