📄 conc_pr2.htm
字号:
<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="08/22/03 10:12:45">
<title>7.1 Processes</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="c2isetto.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="conc_pro.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="conc_pr3.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="c2isetix.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="1204409"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">7.1 Processes</font>
</h2><hr>
<p>
<a name="1204410"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">This section describes the process model supported by the ST20-C2, and introduces the ST20-C2 implementation of processes.</font>
</p>
<p>
<a name="1204411"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">A single ST20-C2 can efficiently implement the process model by sharing processor time between concurrent processes. Also a network of processors can be used to implement the process model with improved performance, by running communicating processes on different processors.</font>
</p>
<p>
<a name="1204412"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Note that although the ST20-C2 has been carefully designed to implement this model of processes, the user is not restricted to this process model. For example, communication between processes on the same ST20-C2 can be achieved via shared variables protected by semaphores.</font>
</p>
<h3>
<a name="1204416"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">7.1.1 The process model</font>
</h3>
<p>
<a name="1204417"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">In the process model, a process starts, performs a number of actions, and then either stops or terminates successfully. Each action is an assignment, an input or an output. An assignment sets the value of a variable, an input receives a value from a channel, and an output sends a value to a channel. The variable set by an assignment should not be accessible to any other process. The only method of transferring information from one process to another should be by using a channel. </font>
</p>
<p>
<a name="1204418"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">At any time, between starting and terminating successfully, a process may be ready to communicate on one or more of its channels. Each channel provides one way communication between two processes.</font>
</p>
<p>
<a name="1204420"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Communication is synchronized. If a channel is used for input in one process and output in another then communication only takes place when both processes are ready. The inputting and outputting processes then proceed with the value output being copied from the outputting process to the inputting process.</font>
</p>
<p>
<a name="1204423"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Externally a process may be seen as being a `black box' that, after starting, may or may not wish to communicate along one or more of its channels until it terminates successfully. In order to perform the task it is designed to achieve, a correctly functioning process normally communicates data with the processes connected to it, and then terminates successfully. However, a process can indefinitely fail to communicate. This failure of communication can be due to internal deadlock (where all internal processes are waiting to communicate with each other), internal livelock (where internal processes are only communicating with themselves and never communicate with the outside world) or due to the process ceasing to execute without terminating successfully (for example, if a process has been compiled to stop if it encounters an error condition).</font>
</p>
<p>
<a name="1204425"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The internal state of a process is not visible to the outside world and all interactions with the process occur via channel communication. This process model removes the problems associated with variable sharing.</font>
</p>
<h3>
<a name="1204428"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">7.1.2 Implementation of processes</font>
</h3>
<p>
<a name="1204429"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">A single ST20-C2 can implement this model of a process, and can simulate concurrent execution of a number of such processes.</font>
</p>
<p>
<a name="1204430"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">At any point in time the processor can only be executing a single process. This is referred to as the `current' process. The current process usually executes for a finite period of time. It ceases to be the current process if it is descheduled (that is, if it stops executing).</font>
</p>
<p>
<a name="1204432"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Any of the following may cause the process to deschedule.</font>
</p>
<ul>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204433"> </a>Execution has reached a point where the process must wait for action by another process (for example, a communication or semaphore).</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204434"> </a>Execution has reached a point where the process must wait for a timer.</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204435"> </a>The process has had its fair share of execution time and must temporarily give way to another process. When this occurs, the process is said to have been `timesliced'.</font></p>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1204437"> </a>The process has executed an instruction which explicitly forces the current process to be stopped or terminated, or forces another process to start executing.</font></p>
</ul>
<p>
<a name="1204438"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Sometimes the current process must give way temporarily to a more urgent (higher priority) process which requires execution. This is referred to as `pre-emption'<a href="#1204441"><sup>1</sup></a>.</font>
</p>
<p>
<a name="1204443"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The transputer provides scheduling queues (sometimes referred to as scheduling lists) to allow for the occurrence of more than one process being ready to execute. Whenever a process becomes ready to execute, it is placed at the end of a scheduling queue. When this occurs, the process is said to be `scheduled'. The processor automatically timeslices the execution of scheduled processes, and so over a period of time, this gives the appearance of more than one process running simultaneously. The set of processes that is either executing, pre-empted or on a scheduling queue, is referred to as the `active set'.</font>
</p>
<p>
<a name="1204445"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Two scheduling queues are maintained by the transputer: a list of low priority processes and a list of high priority processes. In the default scheduling model, high priority processes are always run in preference to low priority processes. No low priority process can be executed until the high priority queue is empty.</font>
</p>
<p>
<a name="1204446"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">By default, whenever a process is placed on the high priority queue, any currently executing low priority process is pre-empted and the high priority process is executed. However a low priority process can explicitly disable pre-emption and timeslicing on the ST20-C2. A high priority process cannot be timesliced or pre-empted by another process.</font>
</p>
<p>
<a name="1207519"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">In addition to this two priority process model, the ST20-C2 provides a system by which the execution can be interrupted in response to external events. Interrupts are signalled to the processor from an interrupt controller peripheral which in turn manages the relative priority of the different interrupts enabling a prioritized pre-emptive interrupt system to be used. Interrupts can be defined to be high or low priority. An interrupt always take precedence over a process at the same priority (a low priority interrupt being pre-empted by a high priority process) and, naturally, high priority interrupts interrupt low priority processes.</font>
</p>
<p>
<a name="1207520"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The processor can monitor a process, for example, for certain error conditions and debug conditions and can optionally cause the machine to halt or to take a `trap' by a context switch to trap handler code.</font>
</p>
<font face="Helvetica"><a href="#1204438"><sup>1</sup></a><pre>
<font face="Helvetica">In the past this behavior has also been called `interruption', however, `pre-emption' is now preferred to distinguish this from interrupts caused by external sources via the interrupt controller</font><a name="1204441"> </a>
</pre>
</font><a name="1204441"> </a>
</blockquote>
<hr>
<table width="331" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><a href="c2isetto.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="conc_pro.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="conc_pr3.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="c2isetix.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"> © 1997, 2001, 2002, 2003 STMicroelectronics. All Rights Reserved.<br>
ADCS 7301761C</font>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -