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