mult_ts5.htm

来自「ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片」· HTM 代码 · 共 97 行

HTM
97
字号
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher Professional Edition 6.0.5">
<meta name="TEMPLATEBASE" content="book_html">
<meta name="LASTUPDATED" content="09/01/03 09:53:34">
<title>7.4 Timeslicing</title>

<STYLE TYPE="text/css">
<!--
	span.Signal { text-transform: uppercase; font-family: Verdana }
-->
</STYLE>

</head>

<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">

<p><img src="images/stlogo.gif" width="106" height="83" align="left"
alt="logo here!"> </p>

<table width="331" border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="st20c1to.htm"><img src="images/navtoc.gif" width="84" height="23"
    border="0" alt="TOC"> </a></td>
    <td><a href="mult_ts4.htm"><img src="images/navprev.gif" width="80" height="23"
    border="0" alt="PREV"> </a></td>
    <td><a href="mult_ts6.htm"><img src="images/navnext.gif" width="83" height="23"
    border="0" alt="NEXT"> </a></td>
    <td><a href="st20c1ix.htm"><img src="images/navidx.gif" width="84" height="23"
    border="0" alt="INDEX"> </a></td>
  </tr>
</table>

<p><br clear="all">
</p>

<hr align="left">

<blockquote>
<h2>
  <a name="1102409"> </a><font color="#003366"  face="Verdana, Arial, Helvetica, sans-serif">7.4 	 Timeslicing</font>
</h2><hr>


<p>
  <a name="1102410"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">The ST20-C1 includes support for timeslicing. Timeslicing is a safeguard in a multi-tasking environment to prevent any one process from taking too much processor time. Exception handlers are not timesliced.</font>
</p>


<p>
  <a name="1102411"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">A timeslicing counter is provided as a field of the <span class=Signal>Status</span> register called the <span class=Signal>timeslice_count</span>. It is reset to <em>MaxTimesliceCount</em> each time a user process is loaded from the scheduling queue into the CPU. The counter is decremented regularly until it reaches 0, and then stays at 0. A timeslice is due when the counter value is 0. </font>
</p>


<p>
  <a name="1102414"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">If a <strong>timeslice</strong> instruction is executed when a timeslice is due and timeslicing is enabled then:</font>
</p>

<ul>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1102415"> </a>the timeslice trap will be taken if it is installed, </font></p>
<p>  <font size=2  face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1102416"> </a>otherwise the current process will be timesliced, that is, the current process is placed on the back of the scheduling queue and the process on the front of the scheduling queue is loaded into the CPU for execution. </font></p>
</ul>

<p>
  <a name="1102417"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">If an exception occurs, the value of the counter is saved with the <span class=Signal>Status</span> register and reloaded when the interrupted or trapped process is restarted. This ensures that a process will be executed for roughly the same time regardless of whether it was interrupted or trapped. </font>
</p>


<p>
  <a name="1102421"> </a><font size=2  face="Verdana, Arial, Helvetica, sans-serif">The <span class=Signal>timeslice_enable</span> bit of the <span class=Signal>Status</span> register can be used to enable or disable timeslicing. Timeslicing is enabled when the bit is set. This bit is preserved when a process is descheduled, so it may be treated as global among user processes. Timeslicing must not be enabled in exception handlers.</font>
</p>
</blockquote>

<hr>



<table width="331" border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="st20c1to.htm"><img src="images/navtoc.gif" width="84" height="23"
    border="0" alt="TOC"> </a></td>
    <td><a href="mult_ts4.htm"><img src="images/navprev.gif" width="80" height="23"
    border="0" alt="PREV"> </a></td>
    <td><a href="mult_ts6.htm"><img src="images/navnext.gif" width="83" height="23"
    border="0" alt="NEXT"> </a></td>
    <td><a href="st20c1ix.htm"><img src="images/navidx.gif" width="84" height="23"
    border="0" alt="INDEX"> </a></td>
  </tr>
</table>
<font size=1 face="Verdana, Arial, Helvetica, sans-serif">&nbsp; &copy; 1997, 2002 STMicroelectronics. All Rights Reserved.<br>
&nbsp; ADCS 7473696A</font>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?