Nucleus参考(一)

来源:互联网 发布:golang ip地址转数字 编辑:程序博客网 时间:2024/05/16 06:36

Introduction
A  task  is  a  semi-independent  program  segment with  a  dedicated  purpose.  Most modern
real-time applications require multiple tasks. Additionally, these tasks often have varying
degrees of importance.  Managing the execution of competing, real-time tasks is the main
purpose of Nucleus PLUS.

介绍

任务是一个有着特定功能的半独立的程序段。现代的实时应用大多都要求多任务。而且,这些任务通常有着不同的重要程度。管理这些相互竞争的、实时的任务是Nucleus PLUS的一个主要职责。

Task States

任务状态
Each  task  is  always  in  one  of  five  states:  executing,  ready,  suspended,  terminated,  or
finished. The following list describes each of the task states:

每个任务总处于以下五个状态中的一种:执行、就绪、挂起、终止和完成。下表描述了每个任务状态:

状态 意义 执行 Task is currently running. 任务正在运行 就绪 Task is ready, but another task is currently running. 任务已经就绪,但其它任务正在运行 挂起 Task is dormant while waiting for the completion of a service request. 
When the request is complete, the task is moved to the ready state. 任务处在休眠状态,等待服务请求完成。当请求完成后,任务就转到就绪状态 终止  Task was killed. Once in this state, the task cannot execute again until it
is reset. 任务被杀死了。一旦处在该状态,任务就不能再执行了,除非重启该任务  完成  Task finished it’s processing and returned from initial entry routine. 
Once in this state, the task cannot execute again until it is reset. 任务完成了处理过程,返回到初始入口例程。一旦任务处在该状态,任务不能再执行,除非重启该任务

 

 

 

 

 

 

 

 

Preemption
Preemption  is  the  act  of  suspending  a  lower  priority  task  when  a  higher  priority  task
becomes  ready.    For  example,  suppose  a  task with  a  priority  of  100  is  executing.    If  an
interrupt  occurs  that  readies  a  task  with  a  priority  of  20,  the  task  with  priority  20  is
executed  before  the  interrupted  task  is  resumed.    Preemption  also  occurs when  a  lower
priority task calls a Nucleus PLUS service that makes a higher priority task ready.
Preemption may be disabled on an individual task basis. When preemption is disabled, no
other  task  is  allowed  to  run  until  the  executing  task  suspends,  relinquishes  control,  or
enables preemption.  A task that suspends or relinquishes control with preemption disabled
has preemption disabled when it is resumed.
A  task  is  created  with  preemption  either  enabled  or  disabled.  Preemption  may  also  be
enabled and disabled during task execution.

原创粉丝点击