Does POSIX standard say EXPLICIT or IMPLICIT SCHED

Ralf Corsepius corsepiu at faw.uni-ulm.de
Wed Dec 4 16:37:17 UTC 2002


Am Mit, 2002-12-04 um 16.48 schrieb Joel Sherrill:
> > > My benchmark code fails to set PTHREAD_EXPLICIT_SCHED and hence
> > > the benchmark task runs at the wrong priority. I had developed the
> > > pthread stuff for RT-Linux (where EXPLICIT_SCHED is the default,
> > > as it is on some other systems, it seems).
> > 
> > I searched some last night
> 
> and unfortunately did not complete this paragraph.  :(
> 
> I looked to see what the POSIX or OpenGroup standards say about this
> and didn't find anything which gave me a clue.

>From SUSV3/pthread_attr_init():

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.

I read this as being "explicitly unspecific", i.e. "everything is
implementation-defined".

>   Does anyone out there
> know what The Right Thing To Do (TM) is?
IMO: "You must not rely on any implicit defaults".


Anyway, from  Solaris-2.7's pthread_attr_init's man-page:

     The pthread_attr_init() function initializes a thread attri-
     butes  object ( attr) with the default value for each attri-
     bute as follows:

        Attribute           Default Value                Meaning of Default
     contentionscope   PTHREAD_SCOPE_PROCESS     resource competition within process
     detachstate       PTHREAD_CREATE_JOINABLE   joinable by other threads
     stackaddr         NULL                      stack allocated by system
     stacksize         NULL                      1 or 2 megabyte
     priority          0                         priority of the thread
     policy            SCHED_OTHER               determined by system
     inheritsched      PTHREAD_EXPLICIT_SCHED    scheduling  policy  and  parameters
                                                 not    inherited   but   explicitly
                                                 defined by the attribute object
     guardsize         PAGESIZE                  size of guard area for a  thread's
                                                 created stack

Linux pthread_attr_init man-page

   inheritsched
       Indicate whether the scheduling policy and  scheduling  parameters  for
       the  newly created thread are determined by the values of the schedpol-
       icy and schedparam attributes  (value  PTHREAD_EXPLICIT_SCHED)  or  are
       inherited from the parent thread (value PTHREAD_INHERIT_SCHED).
 
       Default value: PTHREAD_EXPLICIT_SCHED.

Ralf





More information about the users mailing list