<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- Copyright (C) 2003 Red Hat, Inc. -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- This material may be distributed only subject to the terms -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- and conditions set forth in the Open Publication License, v1.0 -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- or later (the latest version is presently available at -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- http://www.opencontent.org/openpub/). -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- Distribution of the work or derivative of the work in any -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- standard (paper) book form is prohibited unless prior -->
|
<!-- permission is obtained from the copyright holder. -->
|
<!-- permission is obtained from the copyright holder. -->
|
<HTML
|
<HTML
|
><HEAD
|
><HEAD
|
><TITLE
|
><TITLE
|
>Execution Scheduling [POSIX Section 13]</TITLE
|
>Execution Scheduling [POSIX Section 13]</TITLE
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
><meta name="MSSmartTagsPreventParsing" content="TRUE">
|
<META
|
<META
|
NAME="GENERATOR"
|
NAME="GENERATOR"
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
"><LINK
|
"><LINK
|
REL="HOME"
|
REL="HOME"
|
TITLE="eCos Reference Manual"
|
TITLE="eCos Reference Manual"
|
HREF="ecos-ref.html"><LINK
|
HREF="ecos-ref.html"><LINK
|
REL="UP"
|
REL="UP"
|
TITLE="POSIX Standard Support"
|
TITLE="POSIX Standard Support"
|
HREF="posix-standard-support.html"><LINK
|
HREF="posix-standard-support.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="Memory Management [POSIX Section 12]"
|
TITLE="Memory Management [POSIX Section 12]"
|
HREF="posix-memory-management.html"><LINK
|
HREF="posix-memory-management.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="Clocks and Timers [POSIX Section 14]"
|
TITLE="Clocks and Timers [POSIX Section 14]"
|
HREF="posix-clocks-and-timers.html"></HEAD
|
HREF="posix-clocks-and-timers.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="SECT1"
|
CLASS="SECT1"
|
BGCOLOR="#FFFFFF"
|
BGCOLOR="#FFFFFF"
|
TEXT="#000000"
|
TEXT="#000000"
|
LINK="#0000FF"
|
LINK="#0000FF"
|
VLINK="#840084"
|
VLINK="#840084"
|
ALINK="#0000FF"
|
ALINK="#0000FF"
|
><DIV
|
><DIV
|
CLASS="NAVHEADER"
|
CLASS="NAVHEADER"
|
><TABLE
|
><TABLE
|
SUMMARY="Header navigation table"
|
SUMMARY="Header navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TH
|
><TH
|
COLSPAN="3"
|
COLSPAN="3"
|
ALIGN="center"
|
ALIGN="center"
|
>eCos Reference Manual</TH
|
>eCos Reference Manual</TH
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="posix-memory-management.html"
|
HREF="posix-memory-management.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="80%"
|
WIDTH="80%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
>Chapter 31. POSIX Standard Support</TD
|
>Chapter 31. POSIX Standard Support</TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="posix-clocks-and-timers.html"
|
HREF="posix-clocks-and-timers.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"></DIV
|
WIDTH="100%"></DIV
|
><DIV
|
><DIV
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><H1
|
><H1
|
CLASS="SECT1"
|
CLASS="SECT1"
|
><A
|
><A
|
NAME="POSIX-EXECUTION-SCHEDULING">Execution Scheduling [POSIX Section 13]</H1
|
NAME="POSIX-EXECUTION-SCHEDULING">Execution Scheduling [POSIX Section 13]</H1
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="AEN13195">Functions Implemented</H2
|
NAME="AEN13195">Functions Implemented</H2
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SCREEN"
|
CLASS="SCREEN"
|
>int sched_yield(void);
|
>int sched_yield(void);
|
int sched_get_priority_max(int policy);
|
int sched_get_priority_max(int policy);
|
int sched_get_priority_min(int policy);
|
int sched_get_priority_min(int policy);
|
int sched_rr_get_interval(pid_t pid, struct timespec *t);
|
int sched_rr_get_interval(pid_t pid, struct timespec *t);
|
int pthread_attr_setscope(pthread_attr_t *attr, int scope);
|
int pthread_attr_setscope(pthread_attr_t *attr, int scope);
|
int pthread_attr_getscope(const pthread_attr_t *attr, int *scope);
|
int pthread_attr_getscope(const pthread_attr_t *attr, int *scope);
|
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit);
|
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit);
|
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit);
|
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit);
|
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
|
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
|
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy);
|
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy);
|
int pthread_attr_setschedparam( pthread_attr_t *attr, const struct sched_param *param);
|
int pthread_attr_setschedparam( pthread_attr_t *attr, const struct sched_param *param);
|
int pthread_attr_getschedparam( const pthread_attr_t *attr,
|
int pthread_attr_getschedparam( const pthread_attr_t *attr,
|
struct sched_param *param);
|
struct sched_param *param);
|
int pthread_setschedparam(pthread_t thread, int policy,
|
int pthread_setschedparam(pthread_t thread, int policy,
|
const struct sched_param *param);
|
const struct sched_param *param);
|
int pthread_getschedparam(pthread_t thread, int *policy,
|
int pthread_getschedparam(pthread_t thread, int *policy,
|
struct sched_param *param);
|
struct sched_param *param);
|
int pthread_mutexattr_setprotocol( pthread_mutexattr_t *attr,
|
int pthread_mutexattr_setprotocol( pthread_mutexattr_t *attr,
|
int protocol);
|
int protocol);
|
int pthread_mutexattr_getprotocol( pthread_mutexattr_t *attr,
|
int pthread_mutexattr_getprotocol( pthread_mutexattr_t *attr,
|
int *protocol);
|
int *protocol);
|
int pthread_mutexattr_setprioceiling( pthread_mutexattr_t *attr,
|
int pthread_mutexattr_setprioceiling( pthread_mutexattr_t *attr,
|
int prioceiling);
|
int prioceiling);
|
int pthread_mutexattr_getprioceiling( pthread_mutexattr_t *attr,
|
int pthread_mutexattr_getprioceiling( pthread_mutexattr_t *attr,
|
int *prioceiling);
|
int *prioceiling);
|
int pthread_mutex_setprioceiling( pthread_mutex_t *mutex,
|
int pthread_mutex_setprioceiling( pthread_mutex_t *mutex,
|
int prioceiling,
|
int prioceiling,
|
int *old_ceiling);
|
int *old_ceiling);
|
int pthread_mutex_getprioceiling( pthread_mutex_t *mutex,
|
int pthread_mutex_getprioceiling( pthread_mutex_t *mutex,
|
int *prioceiling);</PRE
|
int *prioceiling);</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="AEN13198">Functions Omitted</H2
|
NAME="AEN13198">Functions Omitted</H2
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SCREEN"
|
CLASS="SCREEN"
|
>int sched_setparam(pid_t pid, const struct sched_param *param);
|
>int sched_setparam(pid_t pid, const struct sched_param *param);
|
int sched_getparam(pid_t pid, struct sched_param *param);
|
int sched_getparam(pid_t pid, struct sched_param *param);
|
int sched_setscheduler(pid_t pid, int policy,
|
int sched_setscheduler(pid_t pid, int policy,
|
const struct sched_param *param);
|
const struct sched_param *param);
|
int sched_getscheduler(pid_t pid);</PRE
|
int sched_getscheduler(pid_t pid);</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><H2
|
><H2
|
CLASS="SECT2"
|
CLASS="SECT2"
|
><A
|
><A
|
NAME="AEN13201">Notes</H2
|
NAME="AEN13201">Notes</H2
|
><P
|
><P
|
></P
|
></P
|
><UL
|
><UL
|
><LI
|
><LI
|
><P
|
><P
|
> The functions <SPAN
|
> The functions <SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>sched_setparam()</I
|
>sched_setparam()</I
|
></SPAN
|
></SPAN
|
>,
|
>,
|
<SPAN
|
<SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>sched_getparam()</I
|
>sched_getparam()</I
|
></SPAN
|
></SPAN
|
>,
|
>,
|
<SPAN
|
<SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>sched_setscheduler()</I
|
>sched_setscheduler()</I
|
></SPAN
|
></SPAN
|
> and
|
> and
|
<SPAN
|
<SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>sched_getscheduler()</I
|
>sched_getscheduler()</I
|
></SPAN
|
></SPAN
|
> are present
|
> are present
|
but always return an error.
|
but always return an error.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> The scheduler policy <SPAN
|
> The scheduler policy <SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>SCHED_OTHER</I
|
>SCHED_OTHER</I
|
></SPAN
|
></SPAN
|
> is
|
> is
|
equivalent to <SPAN
|
equivalent to <SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>SCHED_RR</I
|
>SCHED_RR</I
|
></SPAN
|
></SPAN
|
>.
|
>.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> Only <SPAN
|
> Only <SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>PTHREAD_SCOPE_SYSTEM</I
|
>PTHREAD_SCOPE_SYSTEM</I
|
></SPAN
|
></SPAN
|
>
|
>
|
is supported as a
|
is supported as a
|
<SPAN
|
<SPAN
|
CLASS="strong"
|
CLASS="strong"
|
><B
|
><B
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>contentionscope</B
|
>contentionscope</B
|
></SPAN
|
></SPAN
|
>
|
>
|
attribute.
|
attribute.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> The default thread scheduling attributes are:
|
> The default thread scheduling attributes are:
|
<TABLE
|
<TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="SCREEN"
|
CLASS="SCREEN"
|
> contentionscope PTHREAD_SCOPE_SYSTEM
|
> contentionscope PTHREAD_SCOPE_SYSTEM
|
inheritsched PTHREAD_INHERIT_SCHED
|
inheritsched PTHREAD_INHERIT_SCHED
|
schedpolicy SCHED_OTHER
|
schedpolicy SCHED_OTHER
|
schedparam.sched 0
|
schedparam.sched 0
|
</PRE
|
</PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
>
|
>
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> Mutex priority inversion protection is controlled by a
|
> Mutex priority inversion protection is controlled by a
|
number of kernel configuration options.
|
number of kernel configuration options.
|
If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT
|
If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_INHERIT
|
is defined then
|
is defined then
|
{_POSIX_THREAD_PRIO_INHERIT}
|
{_POSIX_THREAD_PRIO_INHERIT}
|
will be defined and PTHREAD_PRIO_INHERIT may
|
will be defined and PTHREAD_PRIO_INHERIT may
|
be set as the protocol in a
|
be set as the protocol in a
|
<SPAN
|
<SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>pthread_mutexattr_t</I
|
>pthread_mutexattr_t</I
|
></SPAN
|
></SPAN
|
>
|
>
|
object.
|
object.
|
If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
|
If CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
|
is defined then
|
is defined then
|
{_POSIX_THREAD_PRIO_PROTECT}
|
{_POSIX_THREAD_PRIO_PROTECT}
|
will be defined and PTHREAD_PRIO_PROTECT may
|
will be defined and PTHREAD_PRIO_PROTECT may
|
be set as the protocol in a
|
be set as the protocol in a
|
<SPAN
|
<SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>pthread_mutexattr_t</I
|
>pthread_mutexattr_t</I
|
></SPAN
|
></SPAN
|
> object.
|
> object.
|
</P
|
</P
|
></LI
|
></LI
|
><LI
|
><LI
|
><P
|
><P
|
> The default attribute values set by
|
> The default attribute values set by
|
<SPAN
|
<SPAN
|
CLASS="emphasis"
|
CLASS="emphasis"
|
><I
|
><I
|
CLASS="EMPHASIS"
|
CLASS="EMPHASIS"
|
>pthread_mutexattr_init()</I
|
>pthread_mutexattr_init()</I
|
></SPAN
|
></SPAN
|
>
|
>
|
is to set the protocol attribute to
|
is to set the protocol attribute to
|
PTHREAD_PRIO_NONE and the prioceiling
|
PTHREAD_PRIO_NONE and the prioceiling
|
attribute to zero.
|
attribute to zero.
|
</P
|
</P
|
></LI
|
></LI
|
></UL
|
></UL
|
></DIV
|
></DIV
|
></DIV
|
></DIV
|
><DIV
|
><DIV
|
CLASS="NAVFOOTER"
|
CLASS="NAVFOOTER"
|
><HR
|
><HR
|
ALIGN="LEFT"
|
ALIGN="LEFT"
|
WIDTH="100%"><TABLE
|
WIDTH="100%"><TABLE
|
SUMMARY="Footer navigation table"
|
SUMMARY="Footer navigation table"
|
WIDTH="100%"
|
WIDTH="100%"
|
BORDER="0"
|
BORDER="0"
|
CELLPADDING="0"
|
CELLPADDING="0"
|
CELLSPACING="0"
|
CELLSPACING="0"
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="posix-memory-management.html"
|
HREF="posix-memory-management.html"
|
ACCESSKEY="P"
|
ACCESSKEY="P"
|
>Prev</A
|
>Prev</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="ecos-ref.html"
|
HREF="ecos-ref.html"
|
ACCESSKEY="H"
|
ACCESSKEY="H"
|
>Home</A
|
>Home</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="posix-clocks-and-timers.html"
|
HREF="posix-clocks-and-timers.html"
|
ACCESSKEY="N"
|
ACCESSKEY="N"
|
>Next</A
|
>Next</A
|
></TD
|
></TD
|
></TR
|
></TR
|
><TR
|
><TR
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="left"
|
ALIGN="left"
|
VALIGN="top"
|
VALIGN="top"
|
>Memory Management [POSIX Section 12]</TD
|
>Memory Management [POSIX Section 12]</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="posix-standard-support.html"
|
HREF="posix-standard-support.html"
|
ACCESSKEY="U"
|
ACCESSKEY="U"
|
>Up</A
|
>Up</A
|
></TD
|
></TD
|
><TD
|
><TD
|
WIDTH="33%"
|
WIDTH="33%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="top"
|
VALIGN="top"
|
>Clocks and Timers [POSIX Section 14]</TD
|
>Clocks and Timers [POSIX Section 14]</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|