232 lines
10 KiB
HTML
232 lines
10 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>sched_setparam</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="sched_setparam"></a> <a name="tag_03_622"></a><!-- sched_setparam -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_622_01"></a>NAME</h4>
|
|
|
|
<blockquote>sched_setparam - set scheduling parameters (<b>REALTIME</b>)</blockquote>
|
|
|
|
<h4><a name="tag_03_622_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('PS')">PS</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> #include <<a href="../basedefs/sched.h.html">sched.h</a>><br>
|
|
<br>
|
|
int sched_setparam(pid_t</tt> <i>pid</i><tt>, const struct sched_param *</tt><i>param</i><tt>); <img src="../images/opt-end.gif"
|
|
alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_03_622_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>sched_setparam</i>() function shall set the scheduling parameters of the process specified by <i>pid</i> to the values
|
|
specified by the <b>sched_param</b> structure pointed to by <i>param</i>. The value of the <i>sched_priority</i> member in the
|
|
<b>sched_param</b> structure shall be any integer within the inclusive priority range for the current scheduling policy of the
|
|
process specified by <i>pid</i>. Higher numerical values for the priority represent higher priorities. If the value of <i>pid</i>
|
|
is negative, the behavior of the <i>sched_setparam</i>() function is unspecified.</p>
|
|
|
|
<p>If a process specified by <i>pid</i> exists, and if the calling process has permission, the scheduling parameters shall be set
|
|
for the process whose process ID is equal to <i>pid</i>.</p>
|
|
|
|
<p>If <i>pid</i> is zero, the scheduling parameters shall be set for the calling process.</p>
|
|
|
|
<p>The conditions under which one process has permission to change the scheduling parameters of another process are
|
|
implementation-defined.</p>
|
|
|
|
<p>Implementations may require the requesting process to have the appropriate privilege to set its own scheduling parameters or
|
|
those of another process.</p>
|
|
|
|
<p>The target process, whether it is running or not running, shall be moved to the tail of the thread list for its priority.</p>
|
|
|
|
<p>If the priority of the process specified by the <i>pid</i> argument is set higher than that of the lowest priority running
|
|
process and if the specified process is ready to run, the process specified by the <i>pid</i> argument shall preempt a lowest
|
|
priority running process. Similarly, if the process calling <i>sched_setparam</i>() sets its own priority lower than that of one or
|
|
more other non-empty process lists, then the process that is the head of the highest priority list shall also preempt the calling
|
|
process. Thus, in either case, the originating process might not receive notification of the completion of the requested priority
|
|
change until the higher priority process has executed.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('SS')">SS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> If
|
|
the scheduling policy of the target process is SCHED_SPORADIC, the value specified by the <i>sched_ss_low_priority</i> member of
|
|
the <i>param</i> argument shall be any integer within the inclusive priority range for the sporadic server policy. The
|
|
<i>sched_ss_repl_period</i> and <i>sched_ss_init_budget</i> members of the <i>param</i> argument shall represent the time
|
|
parameters to be used by the sporadic server scheduling policy for the target process. The <i>sched_ss_max_repl</i> member of the
|
|
<i>param</i> argument shall represent the maximum number of replenishments that are allowed to be pending simultaneously for the
|
|
process scheduled under this scheduling policy.</p>
|
|
|
|
<p>The specified <i>sched_ss_repl_period</i> shall be greater than or equal to the specified <i>sched_ss_init_budget</i> for the
|
|
function to succeed; if it is not, then the function shall fail.</p>
|
|
|
|
<p>The value of <i>sched_ss_max_repl</i> shall be within the inclusive range [1, {SS_REPL_MAX}] for the function to succeed; if
|
|
not, the function shall fail.</p>
|
|
|
|
<p>If the scheduling policy of the target process is either SCHED_FIFO or SCHED_RR, the <i>sched_ss_low_priority</i>,
|
|
<i>sched_ss_repl_period</i>, and <i>sched_ss_init_budget</i> members of the <i>param</i> argument shall have no effect on the
|
|
scheduling behavior. If the scheduling policy of this process is not SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC, the effects of these
|
|
members are implementation-defined; this case includes the SCHED_OTHER policy. <img src="../images/opt-end.gif" alt="[Option End]"
|
|
border="0"></p>
|
|
|
|
<p>If the current scheduling policy for the process specified by <i>pid</i> is not SCHED_FIFO, SCHED_RR, <sup>[<a href=
|
|
"javascript:open_code('SS')">SS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> or
|
|
SCHED_SPORADIC, <img src="../images/opt-end.gif" alt="[Option End]" border="0"> the result is implementation-defined; this
|
|
case includes the SCHED_OTHER policy.</p>
|
|
|
|
<p>The effect of this function on individual threads is dependent on the scheduling contention scope of the threads:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>For threads with system scheduling contention scope, these functions shall have no effect on their scheduling.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>For threads with process scheduling contention scope, the threads' scheduling parameters shall not be affected. However, the
|
|
scheduling of these threads with respect to threads in other processes may be dependent on the scheduling parameters of their
|
|
process, which are governed using these functions.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>If an implementation supports a two-level scheduling model in which library threads are multiplexed on top of several
|
|
kernel-scheduled entities, then the underlying kernel-scheduled entities for the system contention scope threads shall not be
|
|
affected by these functions.</p>
|
|
|
|
<p>The underlying kernel-scheduled entities for the process contention scope threads shall have their scheduling parameters changed
|
|
to the value specified in <i>param</i>. Kernel-scheduled entities for use by process contention scope threads that are created
|
|
after this call completes shall inherit their scheduling policy and associated scheduling parameters from the process.</p>
|
|
|
|
<p>This function is not atomic with respect to other threads in the process. Threads may continue to execute while this function
|
|
call is in the process of changing the scheduling policy for the underlying kernel-scheduled entities used by the process
|
|
contention scope threads.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_622_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>If successful, the <i>sched_setparam</i>() function shall return zero.</p>
|
|
|
|
<p>If the call to <i>sched_setparam</i>() is unsuccessful, the priority shall remain unchanged, and the function shall return a
|
|
value of -1 and set <i>errno</i> to indicate the error.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_622_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>sched_setparam</i>() function shall fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EINVAL]</dt>
|
|
|
|
<dd>One or more of the requested scheduling parameters is outside the range defined for the scheduling policy of the specified
|
|
<i>pid</i>.</dd>
|
|
|
|
<dt>[EPERM]</dt>
|
|
|
|
<dd>The requesting process does not have permission to set the scheduling parameters for the specified process, or does not have
|
|
the appropriate privilege to invoke <i>sched_setparam</i>().</dd>
|
|
|
|
<dt>[ESRCH]</dt>
|
|
|
|
<dd>No process can be found corresponding to that specified by <i>pid</i>.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_622_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_622_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_622_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_622_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_622_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="sched_getparam.html"><i>sched_getparam</i>()</a> , <a href="sched_getscheduler.html"><i>sched_getscheduler</i>()</a> ,
|
|
<a href="sched_setscheduler.html"><i>sched_setscheduler</i>()</a> , the Base Definitions volume of IEEE Std 1003.1-2001,
|
|
<a href="../basedefs/sched.h.html"><i><sched.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_622_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 5. Included for alignment with the POSIX Realtime Extension.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_622_12"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>sched_setparam</i>() function is marked as part of the Process Scheduling option.</p>
|
|
|
|
<p>The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support the Process
|
|
Scheduling option.</p>
|
|
|
|
<p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>In the DESCRIPTION, the effect of this function on a thread's scheduling parameters is added.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>Sections describing two-level scheduling and atomicity of the function are added.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The SCHED_SPORADIC scheduling policy is added for alignment with IEEE Std 1003.1d-1999.</p>
|
|
|
|
<p>IEEE PASC Interpretation 1003.1 #100 is applied.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|