📄 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"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="POSIX Standard Support"HREF="posix-standard-support.html"><LINKREL="PREVIOUS"TITLE="Memory Management [POSIX Section 12]"HREF="posix-memory-management.html"><LINKREL="NEXT"TITLE="Clocks and Timers [POSIX Section 14]"HREF="posix-clocks-and-timers.html"></HEAD><BODYCLASS="SECT1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="posix-memory-management.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 31. POSIX Standard Support</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="posix-clocks-and-timers.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="POSIX-EXECUTION-SCHEDULING">Execution Scheduling [POSIX Section 13]</H1><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN13195">Functions Implemented</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="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><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN13198">Functions Omitted</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="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><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="AEN13201">Notes</H2><P></P><UL><LI><P> The functions <SPANCLASS="emphasis"><ICLASS="EMPHASIS">sched_setparam()</I></SPAN>, <SPANCLASS="emphasis"><ICLASS="EMPHASIS">sched_getparam()</I></SPAN>, <SPANCLASS="emphasis"><ICLASS="EMPHASIS">sched_setscheduler()</I></SPAN> and <SPANCLASS="emphasis"><ICLASS="EMPHASIS">sched_getscheduler()</I></SPAN> are present but always return an error. </P></LI><LI><P> The scheduler policy <SPANCLASS="emphasis"><ICLASS="EMPHASIS">SCHED_OTHER</I></SPAN> is equivalent to <SPANCLASS="emphasis"><ICLASS="EMPHASIS">SCHED_RR</I></SPAN>. </P></LI><LI><P> Only <SPANCLASS="emphasis"><ICLASS="EMPHASIS">PTHREAD_SCOPE_SYSTEM</I></SPAN> is supported as a <SPANCLASS="strong"><BCLASS="EMPHASIS">contentionscope</B></SPAN> attribute. </P></LI><LI><P> The default thread scheduling attributes are: <TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="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 <SPANCLASS="emphasis"><ICLASS="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 <SPANCLASS="emphasis"><ICLASS="EMPHASIS">pthread_mutexattr_t</I></SPAN> object. </P></LI><LI><P> The default attribute values set by <SPANCLASS="emphasis"><ICLASS="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><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="posix-memory-management.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="posix-clocks-and-timers.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Memory Management [POSIX Section 12]</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="posix-standard-support.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="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 + -