对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 ...
随机推荐
- https填坑之旅
Boss说,我们买了个权威证书,不如做全站式的https吧,让用户打开主页就能看到受信任的绿标.于是我们就开始了填坑之旅. [只上主域好不好?] 不好...console会报出一大堆warning因为 ...
- Linux:301重定向 —— 将不带www的重定向到带www的
仓鼠又要手把手教啦 1.先看看自己有没有解析域名(带www和不带www的是两种域名形式!!) 位置:阿里云->域名->解析 2.进入解析,带www的说明你已经解析了www.ljjpm.co ...
- 小技巧:Mac下Metasploit渗透Oracle环境的搭建
Metasploit是一款开源的安全漏洞检测工具,可以帮助安全和IT专业人士识别安全性问题,验证漏洞的缓解措施,并管理专家驱动的安全性进行评估,提供真正的安全风险情报.这些功能包括智能开发,密码审计, ...
- 迷宫问题——BFS
改进版 BFS #include <bits/stdc++.h> using namespace std; #define coordi(x,y) ( m*(x-1)+y ) const ...
- Adobe flash player 因过期而遭到阻止解决办法
最近使用谷歌浏览器时总是提示Adobe flash player 因过期而遭到阻止,这让人很头痛,基本上就是打开一个网页就会弹出一个提示,下面是解决办法. 问题的截图界面: 解决方法:在chrome浏 ...
- 「bzoj4264 小C找朋友」
权限题 就是一个集合\(hash\) 集合\(hash\)可以用于判断两个集合是否相等,具体做法就是给每个随机一个值,之后异或起来就是可以了 这个题就是这样,处理出每个点直接相连的点集的\(hash\ ...
- 20145223 杨梦云 《网络对抗》 MSF基础应用
20145223 杨梦云 <网路对抗> MSF基础应用 1.实验后回答问题:用自己的话解释什么是exploit,payload,encode (1)百度百科上说Exploit 的英文意思就 ...
- vim命令set nu
set nu:为vim设置行号 set nonu:取消vim中的行号
- 富文本使用之wangEditor3
一.介绍: wangEditor —— 轻量级 web 富文本编辑器,配置方便,使用简单.支持 IE10+ 浏览器. 二.使用方式: 直接下载:https://github.com/wangfupen ...
- Redis(RedisTemplate)使用list链表
RedisTemplate配置:https://www.cnblogs.com/weibanggang/p/10188682.html package com.wbg.springRedis.test ...