gnuk/ChibiOS_2.0.6/docs/html/article_roundrobin.html

56 lines
3.8 KiB
HTML
Raw Normal View History

2010-08-10 03:11:02 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ChibiOS/RT: Round Robin scheduling explained</title>
<link href="custom.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<table style="text-align: center; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 80px;"><img alt="ChibiOS/RT Logo" src="logo_small.png"></td>
<td><big><big>ChibiOS/RT</big></big><br><br>Architecture - Reference Manual - Guides</td>
<td style="width: 80px;"></td>
</tr>
</tbody>
</table>
<hr size="1">
2010-11-22 05:53:37 +00:00
<!-- Generated by Doxygen 1.7.1 -->
2010-08-10 03:11:02 +00:00
<div class="navigation" id="top">
<div class="tabs">
2010-11-22 05:53:37 +00:00
<ul class="tablist">
2010-08-10 03:11:02 +00:00
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
2010-11-22 05:53:37 +00:00
<div class="navpath">
<ul>
<li><a class="el" href="main.html">ChibiOS/RT</a> </li>
<li><a class="el" href="articles.html">Articles and Code Samples</a> </li>
<li><a class="el" href="page_kb.html">Knowledge Base</a> </li>
</ul>
2010-08-10 03:11:02 +00:00
</div>
</div>
2010-11-22 05:53:37 +00:00
<div class="header">
<div class="headertitle">
<h1>Round Robin scheduling explained </h1> </div>
</div>
2010-08-10 03:11:02 +00:00
<div class="contents">
2010-11-22 05:53:37 +00:00
<p>Unlike many other RTOSes, ChibiOS/RT supports multiple threads at the same priority level and schedules them using an <em>aggressive</em> round-robin strategy.<br/>
2010-08-10 03:11:02 +00:00
The strategy is defined as aggressive because any scheduling event causes the round-robin threads to rotate.<br/>
A round-robin rotation can happen because of the following events:</p>
<ul>
<li>The currently executed thread voluntarily invokes the <code><a class="el" href="group__threads.html#gacb0a8f22a8358487eaebab3c84b1c4a1" title="Yields the time slot.">chThdYield()</a></code> API in order to allow the execution of another thread at the same priority level, if any.</li>
<li>The currently executed thread voluntarily goes into a sleep state (see <a class="el" href="concepts.html#thread_states">Threads States</a>), when the thread is awakened it goes behind any other thread at the same priority level.</li>
<li>The currently executed thread is preempted by an higher priority thread, the thread is reinserted in the ready list (see <a class="el" href="concepts.html#scheduling">Scheduling</a>) behind any other thread at the same priority level.</li>
<li>If the <code>CH_TIME_QUANTUM</code> configuration constant is set to a value greater than zero and if the specified time quantum expired and if a thread with equal priority is ready then the currently executing thread is automatically reinserted in the ready list behind any other thread at the same priority level.</li>
</ul>
<p>As you can see the <code>CH_TIME_QUANTUM</code> setting is really useful only if there are threads at the same priority level that can run not preempted for long periods of time and that do not explicitly yield using <code><a class="el" href="group__threads.html#gacb0a8f22a8358487eaebab3c84b1c4a1" title="Yields the time slot.">chThdYield()</a></code>. Because of this you should consider setting <code>CH_TIME_QUANTUM</code> to zero in your configuration file, this makes the kernel much faster and smaller and <b>does not</b> forbid the use of multiple threads at the same priority level. </p>
</div>
<hr size="1"><address style="text-align: right;"><small>
2010-11-22 05:53:37 +00:00
Generated on Sun Oct 24 2010 09:40:45 for ChibiOS/RT by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.7.1</small></address>
2010-08-10 03:11:02 +00:00
</body>
</html>