对QP中RTC的理解
1.概念
RTC(Run To Completion)是运行到完成为止的意思。在状态机中,从源状态到目标状态的转换动作要运行到完成。
从字面上来看,这个过程像是不可中断的,但实际并不是,这个过程可以被硬件中断程序打断。
在本状态机中,一个事件处理要是执行了,本状态机的其它事件到来时,就只能在队列中等待,不可中断这个正在处理的过程,也就是要运行到完成(RTC)。这个事件处理完后,才能对队列中的其它事件进行处理。所以在活动对象(Active Object,AO)中总是有一个队列,这个队列用来保存发送到本状态机的事件的。
2. 几种情况
- 更高级任务的事件到来
异步事件
如果在任务L处理事件a时,硬件中断到来了,中断了任务L的事件a处理过程(保存断点),硬件中断中可能产生一个更高级任务H的事件b(异步事件),则在中断返回前执行调度器,处理高级任务H的事件b, 之后,从上边保存的断点返回,继续执行没有完成的任务L的事件a。事件a不是真正的RTC,被事件b中断了。
同步事件
如果在任务L处理事件a时,post了一个事件c(同步事件), 事件c是更高级任务H的,则post()中也调用调度器,先处理任务H的事件c, 之后继续执行任务L的事件a中post()后的代码。事件a不是真正的RTC,被事件c中断了。
- 同级任务的事件到来
如果在任务L处理事件a时,硬件中断中产生了事件d(异步事件),或处理事件a中post了事件d(同步事件), 事件d是属于任务L的,则保存事件d到对应的任务L的队列中,先处理完事件a,之后由QK的循环处理事件d。事件a是RTC的。
- 更低级任务的事件到来
如果在任务L处理事件a时,硬件中断中产生了事件d(异步事件),或处理事件a中post了事件d(同步事件), 事件d是属于比任务L更低的任务LL的,则保存事件d到对应的任务LL的队列中,先处理完事件a,之后由QK的循环处理事件d。事件a是RTC的。
请参考Miro Samek以下的说明:
Miro Samek:"All state machine formalisms, including UML statecharts, universally assume that a state machine completes processing of each event before it can start processing the next event. This model of execution is called run to completion, or RTC.
In the RTC model, the system processes events in discrete, indivisible RTC steps. New incoming events cannot interrupt the processing of the current event and must be stored (typically in an event queue) until the state machine becomes idle again. These semantics completely avoid any internal concurrency issues within a single state machine. The RTC model also gets around the conceptual problem of processing actions associated with transitions, where the state machine is not in a well-defined state(is between two states) for the duration of the action. During event processing, the system is unresponsive (unobservable),so the ill-defined state during that time has no practical significance.
Note, however, that RTC does not mean that a state machine has to monopolize the CPU until the RTC step is complete. The preemption restriction only applies to the task context of the state machine that is already busy processing events. In a multitasking environment, other tasks (not related to the task context of the busy state machine) can be running, possibly preempting the currently executing state machine. As long as other state machines do not share variables or other resources with each other, there are no concurrency hazards.
The key advantage of RTC processing is simplicity. Its biggest disadvantage is that the responsiveness of a state machine is determined by its longest RTC step.4 Achieving short RTC steps can often significantly complicate real-time designs.
"
对QP中RTC的理解的更多相关文章
- Fouandation(NSString ,NSArray,NSDictionary,NSSet) 中常见的理解错误区
Fouandation 中常见的理解错误区 1.NSString //快速创建(实例和类方法) 存放的地址是 常量区 NSString * string1 = [NSString alloc]init ...
- linux中socket的理解
对linux中socket的理解 一.socket 一般来说socket有一个别名也叫做套接字. socket起源于Unix,都可以用“打开open –> 读写write/read –> ...
- 谈谈我对Java中CallBack的理解
谈谈我对Java中CallBack的理解 http://www.cnblogs.com/codingmyworld/archive/2011/07/22/2113514.html CallBack是回 ...
- JavaScript中的闭包理解
原创文章,转载请注明:JavaScript中的闭包理解 By Lucio.Yang 1.JavaScript闭包 在小学期开发项目的时候,用node.js开发了服务器,过程中遇到了node.js的第 ...
- 网站开发进阶(三十四)编码中的setCharacterEncoding 理解
编码中的setCharacterEncoding 理解 1.pageEncoding="UTF-8"的作用是设置JSP编译成Servlet时使用的编码. 2.contentType ...
- 关于zynq7 中MIO的理解
关于zynq7 中MIO的理解 Zynq7000有54个MIO,分配在GPIO的Bank0和Bank1,属于PS部分,这些IO与PS直接相连,不需要添加引脚约束,MIO信号对PL部分是不可见的,对MI ...
- Java 泛型 <? super T> 中 super 怎么 理解?与 < ? extends T>有何不同?
Java 泛型 <? super T> 中 super 怎么 理解?与 extends 有何不同? 简介 前两篇文章介绍了泛型的基本用法.类型擦除以及泛型数组.在泛型的使用中,还有个重要的 ...
- 沉淀再出发:关于java中的AQS理解
沉淀再出发:关于java中的AQS理解 一.前言 在java中有很多锁结构都继承自AQS(AbstractQueuedSynchronizer)这个抽象类如果我们仔细了解可以发现AQS的作用是非常大的 ...
- 关于NAND flash的MTD分区与uboot中分区的理解
关于NAND flash的MTD分区与uboot中分区的理解 转自:http://blog.csdn.net/yjp19871013/article/details/6933455?=40085044 ...
随机推荐
- linux下网络编程学习——入门实例ZZ
http://www.cppblog.com/cuijixin/archive/2008/03/14/44480.html 是不是还对用c怎么实现网络编程感到神秘莫测阿,我们这里就要撕开它神秘的面纱, ...
- 【Leetcode】【Medium】Divide Two Integers
Divide two integers without using multiplication, division and mod operator. If it is overflow, retu ...
- 在win7 windows 上编译 beego 上传到 linux 去执行
在beego的项目目录下,执行: GOOS=linux GOARCH=amd64 go build So easy!但是却搞了好久! 参考连接:http://blog.csdn.net/changji ...
- C# 转换运算符:implicit(隐式),explicit(显示)
//A类 class Cls1 { public string name; //构造函数 public Cls1(string name) { this.name = name; } //implic ...
- Windows软件静默安装
Install Software in A Slient Way 一般来说,不同的软件的封装类型都有固定的静默安装命令. 查看软件的封装类型 双击setup.exe,在弹出窗口的左上角单击,选择&qu ...
- yii2.0中解决post的400错误
不想用gii的表单自己写表单,但是又遇到了400错误,怎么解决?下面为你解答一下:
- June 23rd 2017 Week 25th Friday
Life doesn't get easier, you just get stronger. 生活从未变得轻松,是你在一点一点变得坚强. So in the same way we can get ...
- 贝叶斯网络(Bayesian network))简介(PRML第8.1节总结)概率图模型(Graphical models)
转:http://www.cnblogs.com/Dzhouqi/p/3204353.html 部分图为手写,由于本人字很丑,望见谅,只是想把PRML书的一些部分总结出来,给有需要的人看,希望能帮到一 ...
- 如何在SAP C4C里使用ABSL消费第三方Restful API
首先我们得有一个可以正常工作的Restful API: 然后在Cloud for Customer的Cloud Application Studio里创建Restful API的模型,把第一步可以正常 ...
- Django 按时间来查找数据库中的数据
问题: 按时间来查找数据表中的数据. 前提: 1. 数据表student中有一个字段类型为DateField或者DateTimeField字段, 字段名是birthday. 2. 数据表中已经有些数据 ...