All of lore.kernel.org
 help / color / mirror / Atom feed
From: Loic Domaigne <tech-Z4JMKDdsf89Wk0Htik3J/w@public.gmane.org>
To: Michael Kerrisk <mtk.manpages-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	josv-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	"brian m. carlson"
	<sandals-spVehEqlxw627WubY2PhZQivdfXVPZ6z@public.gmane.org>,
	Bert Wesarg <bert.wesarg-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>,
	Stefan Puiu
	<stefanpuiuro-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>,
	Karsten Weiss
	<K.Weiss-Pt+Xe7GJXK+P2YhJcF5u+nqWYbMAw+HU@public.gmane.org>
Subject: Re: For review: pthread_setschedparam.3
Date: Fri, 21 Nov 2008 20:06:55 +0100	[thread overview]
Message-ID: <492706CF.7080105@domaigne.com> (raw)
In-Reply-To: <4922C81F.6070907-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-11-21 19:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-06 17:45 For review: pthread_setschedparam.3 Michael Kerrisk
     [not found] ` <cfd18e0f0811060945n3224567du5e98adecb074b5e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-11-15 21:09   ` Loic Domaigne
     [not found]     ` <491F3AA6.6050303-Z4JMKDdsf89Wk0Htik3J/w@public.gmane.org>
2008-11-17 18:23       ` Michael Kerrisk
     [not found]         ` <cfd18e0f0811171023l38ae6a0ci1bbece2dcc9e441d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-11-17 19:22           ` Loic Domaigne
     [not found]             ` <4921C470.5070807-Z4JMKDdsf89Wk0Htik3J/w@public.gmane.org>
2008-11-18 12:04               ` Michael Kerrisk
2008-11-18 13:50       ` Michael Kerrisk
     [not found]         ` <4922C81F.6070907-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-11-21 19:06           ` Loic Domaigne [this message]
2008-11-24 21:09           ` sched_setscheduler.3 and threads (was: For review: pthread_setschedparam.3) Loic Domaigne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=492706CF.7080105@domaigne.com \
    --to=tech-z4jmkddsf89wk0htik3j/w@public.gmane.org \
    --cc=K.Weiss-Pt+Xe7GJXK+P2YhJcF5u+nqWYbMAw+HU@public.gmane.org \
    --cc=bert.wesarg-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
    --cc=josv-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
    --cc=sandals-spVehEqlxw627WubY2PhZQivdfXVPZ6z@public.gmane.org \
    --cc=stefanpuiuro-/E1597aS9LQAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.