![]() |
SuperTinyKernel™ RTOS 1.05.3
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Interface for a task switching strategy implementation. More...
#include <stk_common.h>
Public Member Functions | |
| virtual void | AddTask (IKernelTask *task)=0 |
| Add task. | |
| virtual void | RemoveTask (IKernelTask *task)=0 |
| Remove task. | |
| virtual IKernelTask * | GetFirst () const =0 |
| Get first task. | |
| virtual IKernelTask * | GetNext ()=0 |
| Advance the internal iterator and return the next runnable task. | |
| virtual size_t | GetSize () const =0 |
| Get number of tasks currently managed by this strategy. | |
| virtual void | OnTaskSleep (IKernelTask *task)=0 |
| Notification that a task has entered sleep/blocked state. | |
| virtual void | OnTaskWake (IKernelTask *task)=0 |
| Notification that a task is becoming runnable again. | |
| virtual bool | OnTaskDeadlineMissed (IKernelTask *task)=0 |
| Notification that a task has exceeded its HRT deadline; returns whether the strategy can recover without a hard fault. | |
Interface for a task switching strategy implementation.
Implementation must declare the following compile-time constants for reporting its capabilities to the kernel (place inside EConfig enum):
Example:
Definition at line 781 of file stk_common.h.
|
pure virtual |
Add task.
| [in] | task | Pointer to the task to add. |
Implemented in stk::SwitchStrategyEDF, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES >, stk::SwitchStrategyFixedPriority< 32 >, stk::SwitchStrategyMonotonic< _Type >, stk::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::SwitchStrategyRoundRobin, and stk::SwitchStrategySmoothWeightedRoundRobin.
|
pure virtual |
Get first task.
NULL if no tasks have been added. Implemented in stk::SwitchStrategyEDF, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES >, stk::SwitchStrategyFixedPriority< 32 >, stk::SwitchStrategyMonotonic< _Type >, stk::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::SwitchStrategyRoundRobin, and stk::SwitchStrategySmoothWeightedRoundRobin.
Referenced by stk::SchedulabilityCheck::IsSchedulableWCRT(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TestAlgorithm(), and stk::test::TestPriorityNext().
|
pure virtual |
Advance the internal iterator and return the next runnable task.
NULL if no runnable tasks are available (in which case the kernel transitions to FSM_STATE_SLEEPING). Implemented in stk::SwitchStrategyEDF, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES >, stk::SwitchStrategyFixedPriority< 32 >, stk::SwitchStrategyMonotonic< _Type >, stk::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::SwitchStrategyRoundRobin, and stk::SwitchStrategySmoothWeightedRoundRobin.
Referenced by stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TestAlgorithm(), and stk::test::TestPriorityNext().
|
pure virtual |
Get number of tasks currently managed by this strategy.
Implemented in stk::SwitchStrategyEDF, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES >, stk::SwitchStrategyFixedPriority< 32 >, stk::SwitchStrategyMonotonic< _Type >, stk::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::SwitchStrategyRoundRobin, and stk::SwitchStrategySmoothWeightedRoundRobin.
Referenced by stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), and stk::test::TEST().
|
pure virtual |
Notification that a task has exceeded its HRT deadline; returns whether the strategy can recover without a hard fault.
| [in] | task | The task whose deadline was missed. Must not be nullptr. |
true — the strategy has absorbed the overrun (e.g. by escalating its scheduling mode); the kernel must not call HrtHardFailDeadline() for this tick. false — the strategy cannot recover; the kernel must call HrtHardFailDeadline() as normal. DEADLINE_MISSED_API == 1 in the concrete strategy's EConfig. Strategies that set DEADLINE_MISSED_API = 0 do not need to implement this method; the kernel will not call it and will proceed directly to HrtHardFailDeadline(). true carries no implicit side-effects on task sleep state or duration counters — normal tick-driven scheduling remains responsible for those. This call only communicates "do not hard-fault this tick." false (unrecoverable), which is the correct default for strategies that do not implement overrun recovery. Implemented in stk::SwitchStrategyEDF, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES >, stk::SwitchStrategyFixedPriority< 32 >, stk::SwitchStrategyMonotonic< _Type >, stk::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::SwitchStrategyRoundRobin, and stk::SwitchStrategySmoothWeightedRoundRobin.
Referenced by stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), stk::test::TEST(), and stk::test::TEST().
|
pure virtual |
Notification that a task has entered sleep/blocked state.
| [in] | task | Pointer to the sleeping task, |
Implemented in stk::SwitchStrategyEDF, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES >, stk::SwitchStrategyFixedPriority< 32 >, stk::SwitchStrategyMonotonic< _Type >, stk::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::SwitchStrategyRoundRobin, and stk::SwitchStrategySmoothWeightedRoundRobin.
Referenced by stk::test::TEST().
|
pure virtual |
Notification that a task is becoming runnable again.
| [in] | task | Pointer to the waking task |
Implemented in stk::SwitchStrategyEDF, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES >, stk::SwitchStrategyFixedPriority< 32 >, stk::SwitchStrategyMonotonic< _Type >, stk::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::SwitchStrategyRoundRobin, and stk::SwitchStrategySmoothWeightedRoundRobin.
Referenced by stk::test::TEST().
|
pure virtual |
Remove task.
| [in] | task | Pointer to the task to remove. |
Implemented in stk::SwitchStrategyEDF, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES >, stk::SwitchStrategyFixedPriority< 32 >, stk::SwitchStrategyMonotonic< _Type >, stk::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::SwitchStrategyRoundRobin, and stk::SwitchStrategySmoothWeightedRoundRobin.