你的位置:首页 > 软件开发 > 操作系统 > 对QP中RTC的理解

对QP中RTC的理解

发布时间:2015-12-02 15:00:55
RTC(Run To Completion)是运行到完成为止的意思。在状态机中,从源状态到目标状态的转换动作要运行到完成。从字面上来看,这个过程像是不可中断的,但实际并不是,这个过程可以 被硬件中断程序打断,也可以被另一个状态机的事件所打断,只是不能被本状态机的其它事件所打断。在 ...

RTC(Run To Completion)是运行到完成为止的意思。在状态机中,从源状态到目标状态的转换动作要运行到完成。

从字面上来看,这个过程像是不可中断的,但实际并不是,这个过程可以 被硬件中断程序打断,也可以被另一个状态机的事件所打断,只是不能被本状态机的其它事件所打断。

在本状态机中,一个事件处理要是执行了,本状态机的其它事件到来时,就只能在队列中等待,不可中断这个正在处理的过程,也就是要运行到完成(RTC)。这个事件处理完后,才能对队列中的其它事件进行处理。

所以在活动对象(Active Object,AO)中总是有一个队列,这个队列用来保存发送到本状态机的事件的。

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的理解

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录