QP/C++  5.9.5
QK

Preemptive Run-to-Completion Kernel. More...

Files

file  qk.h
 QK/C++ platform-independent public interface.
 
file  qpcpp.h
 QP/C++ public interface including backwards-compatibility layer.
 
file  qk.cpp
 QK preemptive kernel core functions.
 
file  qk_mutex.cpp
 QP::QMutex::init(), QP::QMutex::lock(), and QP::QMutex::unlock() definitions.
 
file  qf_port.h
 QF/C++ port to Lint, Generic C++ compiler.
 
file  qf_port.h
 QF/C++ port to Lint, Generic C++ compiler.
 

Namespaces

 QP
 namespace associated with the QP/C++ framework
 

Detailed Description

Preemptive Run-to-Completion Kernel.

QK is a tiny preemptive, priority-based, non-blocking kernel designed specifically for executing active objects. QK runs active objects in the same way as prioritized interrupt controller (such as NVIC in ARM Cortex-M) runs interrupts using the single stack. Active objects process their events in run-to-completion (RTC) fashion and remove themselves from the call stack, the same way as nested interrupts remove themselves from the stack upon completion. At the same time high-priority active objects can preempt lower-priority active objects, just like interrupts can preempt each other under a prioritized interrupt controller. QK meets all the requirement of the Rate Monotonic Scheduling (a.k.a. Rate Monotonic Analysis RMA) and can be used in hard real-time systems.


QK Overview

Sometimes it is not practical to break up long RTC steps, and consequently the task-level response of the simple "QV kernel" might be too slow. In this cases you need to use a preemptive kernel. The big advantage of preemptive kernel is that it effectively decouples high-priority task from low-priority tasks in the time domain. The timeliness of execution of high-priority task is almost independent on the low-priority tasks. But of course there is no such thing as a free lunch. Preemptive kernels open the whole new class of problems related to race conditions. So you need to be very careful about sharing any resources.