public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/7007] New: PTHREAD_EXPLICIT_SCHED not honored after 'attr' is initialized to defaults
@ 2008-11-05 19:30 mtk dot manpages at gmail dot com
  2008-11-05 19:43 ` [Bug nptl/7007] " mtk dot manpages at gmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-11-05 19:30 UTC (permalink / raw)
  To: glibc-bugs

The POSIX.1-2001 specification of pthread_attr_init() says:

   The  pthread_attr_init()  function  shall  initialize  a thread
   attributes object attr with the default value for  all  of  the
   individual attributes used by a given implementation.

Among other things, pthread_attr_init() (quite reasonably) initializes the
scheduling policy to SCHED_OTHER, and the scheduling priority to 0.

The POSIX.1-2001 specification of pthread_attr_setinheritsched() says:

    PTHREAD_INHERIT_SCHED
          Specifies that the thread scheduling attributes shall be
          inherited  from  the creating thread, and the scheduling
          attributes in this attr argument shall be ignored.

    PTHREAD_EXPLICIT_SCHED
           Specifies that the thread scheduling attributes shall be
           set  to  the  corresponding  values from this attributes
           object.

Thus, as I read the standard, if we initialize a thread attribute object to the
defaults (using pthread_attr_init()), and then set the inheritsched attribute to
PTHREAD_EXPLICIT_SCHED, then a new thread created using this attribute object
should have its scheduling policy and priority set to SCHED_OTHER and 0,
respectively.  However, instead, these values are taken from the calling thread
(i.e., as though the inheritsched attribute had been set to
PTHREAD_INHERIT_SCHED).  As far as I can see this is in violation of the
specification and should be changed.

-- 
           Summary: PTHREAD_EXPLICIT_SCHED not honored after 'attr' is
                    initialized to defaults
           Product: glibc
           Version: 2.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: mtk dot manpages at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=7007

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug nptl/7007] PTHREAD_EXPLICIT_SCHED not honored after 'attr' is initialized to defaults
  2008-11-05 19:30 [Bug nptl/7007] New: PTHREAD_EXPLICIT_SCHED not honored after 'attr' is initialized to defaults mtk dot manpages at gmail dot com
@ 2008-11-05 19:43 ` mtk dot manpages at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: mtk dot manpages at gmail dot com @ 2008-11-05 19:43 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From mtk dot manpages at gmail dot com  2008-11-05 19:41 -------
Created an attachment (id=3042)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=3042&action=view)
test program

The attached test program can be used to demonstrate the reported behavior
using the following command:


$ sudo ./pthreads_sched_test -mf10 -i e
root's password:
Scheduler settings of main thread
    policy=SCHED_FIFO, priority=10

Scheduler settings in 'attr'
    policy=SCHED_OTHER, priority=0
    inheritsched is EXPLICIT

About to call pthread_create() with attrp=0xbfeacb54

Scheduler attributes of new thread
    policy=SCHED_FIFO, priority=10

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=7007

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-05 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-05 19:30 [Bug nptl/7007] New: PTHREAD_EXPLICIT_SCHED not honored after 'attr' is initialized to defaults mtk dot manpages at gmail dot com
2008-11-05 19:43 ` [Bug nptl/7007] " mtk dot manpages at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).