OSF DCE Application Development Guide--Core Components
OSF DCE Application Development Guide—Core Components
• SCHED_BG_NP (Background)
Like SCHED_OTHER and SCHED_FG_NP, SCHED_BG_NP ensures that all
threads, regardless of priority, receive some scheduling. However, SCHED_BG_NP
can be denied execution by the SCHED_FIFO or SCHED_RR policies. The BG
stands for background.
The following two methods are used to set the scheduling policy attribute:
• Set the scheduling policy attribute in the attributes object, which establishes the
scheduling policy of a new thread when it is created. To do this, call the
pthread_attr_setsched( ) routine.
• Change the scheduling policy of an existing thread (and, at the same time, the
scheduling priority) by calling the pthread_setscheduler() routine.
Section 7.8 describes and shows the effect of scheduling policy on thread scheduling.
7.3.3.2 Scheduling Priority Attribute
The scheduling priority attribute specifies the execution of a thread. This attribute is
expressed relative to other threads on a continuum of minimum to maximum for each
scheduling policy. A thread’s priority falls within one of the following ranges, which are
implementation defined:
• PRI_FIFO_MIN to PRI_FIFO_MAX
• PRI_RR_MIN to PRI_RR_MAX
• PRI_OTHER_MIN to PRI_OTHER_MAX
• PRI_FG_MIN_NP to PRI_FG_MAX_NP
• PRI_BG_MIN_NP to PRI_BG_MAX_NP
The following two methods are used to set the scheduling priority attribute:
• Set the scheduling priority attribute in the attributes object, which establishes the
execution priority of a new thread when it is created. To do this, call the
pthread_attr_setprio() routine.
• Change the scheduling priority attribute of an existing thread by calling the
pthread_setprio( ) routine. (Call the pthread_setscheduler() routine to change both
the scheduling priority and scheduling policy of an existing thread.)
7.3.3.3 Inherit Scheduling Attribute
The inherit scheduling attribute specifies whether a newly created thread inherits the
scheduling attributes (scheduling priority and policy) of the creating thread (the default),
or uses the scheduling attributes stored in the attributes object. Set this attribute by
calling the routine pthread_attr_setinheritsched( ).
7− 6 Tandem Computers Incorporated 124245