Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dg_pthread_groupattr_setsched(3T) — DG/UX R4.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

threads(5)



SDK R4.11                           dg_pthread_groupattr_setinheritsched(3T)


NAME
       dgpthreadgroupattrsetinheritsched,
       dgpthreadgroupattrgetinheritsched, dgpthreadgroupattrsetsched,
       dgpthreadgroupattrgetsched, dgpthreadgroupattrsetprio,
       dgpthreadgroupattrgetprio - control thread group scheduling
       attributes

SYNOPSIS
       #include <pthread.h>

       int dgpthreadgroupattrsetinheritsched(dgpthreadgroupattrt *attr,
                                                int inherit);

       int dgpthreadgroupattrgetinheritsched(dgpthreadgroupattrt *attr,
                                                int * inherit);

       int dgpthreadgroupattrsetsched(dgpthreadgroupattrt *attr,
                                         int scheduler);

       int dgpthreadgroupattrgetsched(dgpthreadgroupattrt *attr,
                                         int * scheduler);

       int dgpthreadgroupattrsetprio(dgpthreadgroupattrt *attr,
                                        int priority);

       int dgpthreadgroupattrgetprio(dgpthreadgroupattrt *attr,
                                        int * priority);

   where:
       attr            A pointer to a thread group attributes object.
       inherit         For dgpthreadgroupattrsetinheritsched(), an
                       integer representing PTHREAD_INHERIT_SCHED or
                       PTHREAD_DEFAULT_SCHED.  For
                       dgpthreadgroupattrgetinheritsched(), a pointer to
                       an integer to receive the inheritsched attribute.
       scheduler       For dgpthreadgroupattrsetsched(), an integer
                       representing SCHED_OTHER, SCHED_FIFO, SCHED_RR,
                       SCHED_DG_TS, SCHED_DG_FIFO, or SCHED_DG_LIFO
                       scheduling policy.  For
                       dgpthreadgroupattrgetsched(), a pointer to an
                       integer to receive the scheduling policy.
       priority        For dgpthreadgroupattrsetprio(), an integer
                       priority for a thread group.  For
                       dgpthreadgroupattrgetprio(), a pointer to an
                       integer to receive the priority.

DESCRIPTION
       The scheduling attributes of a thread group can be specified when a
       thread group is created.  Furthermore, some scheduling attributes,
       namely the thread group's scheduling policy and priority, can be
       changed after a thread group has been created.

       The inheritsched attribute determines whether newly created thread
       groups should inherit the scheduling attributes of the creating
       thread group (default), or should use the scheduling attributes
       described next.  In other words, if scheduling is to be inherited,
       all of the scheduling attributes discussed next are ignored.

       There are two levels of scheduling in the system: local and global.
       All thread groups have global contention scope.  Threads are
       scheduled locally within thread groups.  Even globally scheduled
       threads are implemented using dedicated thread groups.  Refer to
       <sys/intd6pthread.h> and pthreadattrsetscope(3T) for a more
       detailed discussion on contention scope.

       The scheduling policy and priority determine how affected thread
       groups will be scheduled globally.  The scheduling policies and
       priority ranges are the same as those specified in the Posix 1003.4
       Realtime standard, except that they apply to thread groups instead of
       processes.  Refer to <sched.h>, schedsetscheduler()(2), and
       schedsetparam()(2) for a discussion of these scheduling policies and
       priorites as used for processes.  A similar discussion applies to
       threads and thread groups.

       For a thread group inheriting the scheduling attributes of its
       creator, the new thread group will naturally inherit the scheduling
       policy and priority of its creator's thread group.

       Once a thread group has been created, scheduling policy and priority
       may be changed.  Refer to dgpthreadgroupsetschedattr(3T) for a
       discussion on changing the scheduling attributes of an existing
       thread group.

       The following functions control thread group scheduling attributes:

   dgpthreadgroupattrsetinheritsched() and
       dgpthreadgroupattrgetinheritsched()
       These functions set and get the inheritsched attribute in the
       attributes object pointed to by the attr argument.  When attribute
       objects are used by dgpthreadgroupcreate(), the inheritsched
       attribute determines how the other scheduling attributes of the
       created thread group are to be set.

       The following symbols are defined in the header <pthread.h>:
              PTHREAD_INHERIT_SCHED  The scheduling policy and priority are
                                     to be inherited from the creating
                                     thread group.  This is the default.
              PTHREAD_DEFAULT_SCHED  The scheduling policy and priority are
                                     to be set to the corresponding values
                                     from this attributes object.

   dgpthreadgroupattrsetsched(), and dgpthreadgroupattrgetsched()
       These functions set and get the scheduling policy attribute in the
       attributes object pointed to by attr.

       The scheduler attribute defines the scheduling policy of thread
       groups.  The scheduler values are defined by the header <sched.h> and
       have the following meanings:
              SCHED_OTHER  Default DG/UX scheduling policy, which is the
                           same as SCHED_DG_TS, the timesharing scheduling
                           policy
              SCHED_FIFO   First-in first-out, which means that the thread
                           group runs until it blocks or is preempted by a
                           higher priority thread group
              SCHED_RR     Round robin, which is the same as SCHED_FIFO,
                           except the thread group yields to peers when runs
                           out a timeslice
              SCHED_DG_TS  DG/UX timesharing scheduling policy, which is the
                           same as SCHED_OTHER
              SCHED_DG_FIFO
                           Same as SCHED_FIFO, except the entire range of
                           priorities are allowed.  This is a hard realtime
                           scheduling policy.
              SCHED_DG_LIFO
                           Last-in first-out, which means that unblocked
                           thread groups will be placed before other thread
                           groups of equal priority; otherwise this policy
                           is the same as SCHED_DG_FIFO.

   dgpthreadgroupattrsetprio() and dgpthreadgroupattrgetprio()
       These functions set and get the priority attribute in the attributes
       object pointed to by attr.  The allowed priority range for each
       scheduling policy can be obtained using calls to
       schedprioritygetmax(2) and schedprioritygetmin(2).

DIAGNOSTICS
   Return Value
       If successful, dgpthreadgroupattrgetinheritsched(),
       dgpthreadgroupattrgetsched(), and dgpthreadgroupattrgetprio()
       return the inheritsched, scheduler, and priority attributes,
       respectively.  Otherwise, they return -1 and set errno to indicate
       the error.

       If successful, dgpthreadgroupattrsetinheritsched(),
       dgpthreadgroupattrsetsched(), and dgpthreadgroupattrsetprio()
       change the values for the inheritsched, scheduler, and priority
       attributes, respectively.  Otherwise, they return -1 and set errno to
       indicate the error.

   Errors
       For each of the following conditions,
       dgpthreadgroupattrsetinheritsched(),
       dgpthreadgroupattrgetinheritsched(),
       dgpthreadgroupattrsetsched(), dgpthreadgroupattrgetsched(),
       dgpthreadgroupattrsetprio(), dgpthreadgroupattrgetprio() return
       -1 and set errno to the corresponding value:

       [EINVAL]  An invalid attributes object has been specified.  This
                 occurs when DG/UX has detected that the attributes object
                 pointed to by attr has not been initialized by a previous
                 call to dgpthreadgroupattrinit() or has been corrupted.

       For each of the following conditions,
       dgpthreadgroupattrsetinheritsched() returns -1 and sets errno to
       the corresponding value:

       [EINVAL]  The value of inherit is not PTHREADINHERITSCHED or
                 PTHREADDEFAULTSCHED.

       For each of the following conditions, dgpthreadgroupattrsetsched()
       returns -1 and sets errno to the corresponding value:

       [EINVAL]  The value of scheduler is not one of the supported
                 scheduling policies.

       For each of the following conditions, dgpthreadgroupattrsetprio()
       returns -1 and sets errno to the corresponding value:

       [EINVAL]  The value of prio is outside the absolute range of
                 priorities allowed on the system.

SEE ALSO
       dgpthreadgroupattrinit(3T), dgpthreadgroupcreate(3T),
       dgpthreadgroupsetschedattr(3T), schedgetprioritymax(2),
       schedgetprioritymin(2), schedsetscheduler(2), schedsetparam(2),
       schedyield()(2), pthreadattrinit(3T), threads(5).

NOTES
       The exact meanings of local vs. global scopes vary from system to
       system.

       An application should not make any assumptions about the absolute
       priority ranges for the supported scheduling policies, other than
       SCHEDFIFO and SCHEDRR having higher priority ranges than
       SCHEDOTHER.  The absolute values for the ranges can change from
       release to release.  An application should use relative values or
       make queries using schedpriorityget{min,max}().

       Note that, if an application specifies a priority value that is out-
       of-range for the desired scheduling policy, the error will not occur
       until the attributes object is used in a call to
       dgpthreadgroupcreate() or dgpthreadgroupsetschedattr().  The
       only case where it will be caught by dgpthreadgroupattrsetprio()
       is where the priority value is out-of-range of the absolute priority
       values allowed on the system as a whole.

       Similarly, permissions are not checked until an attributes object is
       actually used on a thread group.  Special permission may be required
       to explicitly set these attributes for a thread group.  Inheriting
       attributes never requires special permissions.


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026