QP/C  5.9.5

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


file  qk.h
 QK/C (preemptive non-blocking kernel) platform-independent public interface.
file  qpc.h
 QP/C public interface including backwards-compatibility layer.
file  qk.c
 QK preemptive kernel core functions.
file  qk_mutex.c
 QMutex_init(), QMutex_lock and QMutex_unlock() definitions.
file  qf_port.h
 QF/C port example for QK, generic C compiler.
file  qk_port.h
 QK/C port example for a generic C compiler.

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.