Gidday Michael,
Okay, here I'll revisit this piece.
The returned priority value is that set by the most recent
.BR pthread_setschedparam (),
.BR pthread_setschedprio (3),
or
.BR pthread_create (3)
call that affected
.IR thread .
Hmm, that's perfectly right from a POSIX point of view. Knowing how
Linux implements threads, I have been interested about the effect of
sched_setscheduler() on a MT-process (since NPTL uses 1:1 model, this
should be a NOP).
Why should it be a NOP?
Because it is stated in SuSv3 TC2:
<copy>
Each process shall be controlled by an associated scheduling policy and
priority. These parameters may be specified by explicit application
execution of the sched_setscheduler() or sched_setparam() functions.
The effect of the process scheduling attributes on individual threads
in the process is dependent on the scheduling contention scope of the
threads, see <ref>Thread Scheduling</ref>:
(*) For threads with system scheduling contention scope, the process
scheduling attributes shall have no effect on the scheduling attributes
or behavior either of the visible POSIX thread or an underlying kernel
scheduling entity dedicated to that thread.
[...]
</copy>
Since NPTL uses 1:1 model, i.e. all threads have system scheduling
contention scope. Hence, sched_setscheduler() should not affect the
current threads scheduling.
It happens that I know this part of the standard quite well, because I
reworked it together with David Butenhof 4 years ago (XSH ERN 52)... We
attempt to describe in a better way what 1003.1-2004 meant in this regard.
By the way, on GNU/Linux sched_setscheduler() might possibly affect the
scheduling of the calling thread (and not only the main thread, as
stated in my previous email). This was the true some Glibc version ago...
See also:
http://groups.google.de/group/comp.unix.programmer/browse_thread/thread/2531f90c0b05ef95/e66e69ad57349f7f
https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=show_archive.tpl&source=L&listname=austin-group-l&id=8143
http://groups.google.de/group/comp.unix.programmer/browse_thread/thread/5c305e82eef3f975/3cbb9722f1f49c15
http://www.qnx.com/developers/docs/6.3.2/neutrino/lib_ref/s/sched_setscheduler.html
HTH,
Loïc.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html