SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk::ITaskSwitchStrategy Class Referenceabstract

Interface for a task switching strategy implementation. More...

#include <stk_common.h>

Inheritance diagram for stk::ITaskSwitchStrategy:
Collaboration diagram for stk::ITaskSwitchStrategy:

Public Member Functions

virtual void AddTask (IKernelTask *task)=0
 Add task.
virtual void RemoveTask (IKernelTask *task)=0
 Remove task.
virtual IKernelTask * GetFirst ()=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 OnTaskYield (IKernelTask *task)
 Notification that the running task called Yield() (non-HRT kernel modes only).
virtual bool OnTaskTimeSlice (IKernelTask *task)
 Notification that the running task's time slice expired (KERNEL_TIMESLICE only).
virtual bool OnTaskDeadlineMissed (IKernelTask *task)
 Notification that a task has exceeded its HRT deadline; returns whether the strategy can recover without a hard fault.
virtual void OnTaskWeightChange (IKernelTask *task, Weight old_weight)
 Notification that a runnable task's scheduling weight has changed.

Protected Member Functions

 ~ITaskSwitchStrategy ()=default
 Destructor.

Detailed Description

Interface for a task switching strategy implementation.

Note
Combines the Strategy and Iterator design patterns.
  • Strategy: concrete subclasses encapsulate the scheduling policy (round-robin, EDF, rate-monotonic, weighted round-robin, etc.) independently of the kernel.
  • Iterator: GetFirst() and GetNext() expose a stateful forward-iterator over the runnable task set. The cursor is owned by the concrete implementation and is not exposed directly, iteration is therefore not re-entrant.

Implementation must declare the following compile-time constants for reporting its capabilities to the kernel (place inside EConfig enum):

Example:

enum EConfig
{
WEIGHT_API = 0, // (1) if strategy needs Weight API of the kernel task, (0) otherwise (see \a IKernelTask and Weight API functions)
SLEEP_EVENT_API = 0, // (1) if strategy needs Sleep API events generated by the kernel, (0) otherwise (see \a ITaskSwitchStrategy::OnTaskSleep, \a ITaskSwitchStrategy::OnTaskWake)
DEADLINE_MISSED_API = 0, // (1) if strategy implements OnTaskDeadlineMissed() and can absorb HRT deadline overruns, (0) otherwise (see \a ITaskSwitchStrategy::OnTaskDeadlineMissed)
PRIORITY_INHERITANCE_API = 0, // (1) if strategy expects OnTaskWeightChange() events to support priority inheritance requests
NOSLEEP_YIELD_API = 0, // (1) if strategy implements OnTaskYield() and handles Yield() without putting the task to sleep, (0) otherwise (see \a ITaskSwitchStrategy::OnTaskYield)
TIMESLICE_API = 0 // (1) if GetNext() is sticky (does not rotate same-priority peers by itself) and OnTaskTimeSlice() rotates them, (0) otherwise (see \a ITaskSwitchStrategy::OnTaskTimeSlice)
};

Definition at line 1405 of file stk_common.h.

Constructor & Destructor Documentation

◆ ~ITaskSwitchStrategy()

stk::ITaskSwitchStrategy::~ITaskSwitchStrategy ( )
protecteddefault

Destructor.

Note
Protected by design. Prevents unsafe polymorphic delete.

Member Function Documentation

◆ AddTask()

virtual void stk::ITaskSwitchStrategy::AddTask ( IKernelTask * task)
pure virtual

Add task.

Note
Kernel tasks are added by the concrete implementation of IKernel.
Parameters
[in]taskPointer to the task to add.

Implemented in stk::sched::SwitchStrategyEDF, stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyMonotonic< TStrategyType >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::SwitchStrategyMonotonic< TStrategyType >, stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::SwitchStrategyRoundRobinT< NoSleepYield >, and stk::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >.

◆ GetFirst()

virtual IKernelTask * stk::ITaskSwitchStrategy::GetFirst ( )
pure virtual

Get first task.

Returns
Pointer to the first task in the managed set, or NULL if no tasks have been added.

Implemented in stk::sched::SwitchStrategyEDF, stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyMonotonic< TStrategyType >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::SwitchStrategyMonotonic< TStrategyType >, stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::SwitchStrategyRoundRobinT< NoSleepYield >, and stk::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >.

◆ GetNext()

virtual IKernelTask * stk::ITaskSwitchStrategy::GetNext ( )
pure virtual

Advance the internal iterator and return the next runnable task.

Returns
Pointer to the next active task to schedule, or NULL if no runnable tasks are available (in which case the kernel transitions to FSM_STATE_SLEEPING).
Note
Implementations maintain an internal cursor. This method is not re-entrant, concurrent calls from multiple contexts are not supported.

Implemented in stk::sched::SwitchStrategyEDF, stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyMonotonic< TStrategyType >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::SwitchStrategyMonotonic< TStrategyType >, stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::SwitchStrategyRoundRobinT< NoSleepYield >, and stk::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >.

◆ GetSize()

virtual size_t stk::ITaskSwitchStrategy::GetSize ( ) const
pure virtual

Get number of tasks currently managed by this strategy.

Returns
Total number of tasks in the set (runnable and idle).

Implemented in stk::sched::SwitchStrategyEDF, stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyMonotonic< TStrategyType >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::SwitchStrategyMonotonic< TStrategyType >, stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::SwitchStrategyRoundRobinT< NoSleepYield >, and stk::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >.

◆ OnTaskDeadlineMissed()

virtual bool stk::ITaskSwitchStrategy::OnTaskDeadlineMissed ( IKernelTask * task)
inlinevirtual

Notification that a task has exceeded its HRT deadline; returns whether the strategy can recover without a hard fault.

Parameters
[in]taskThe task whose deadline was missed. Must not be nullptr.
Returns
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.
Note
Budget Overrun API. Called by the kernel from UpdateTaskState() within a tick, after GetNext() has already been called for that tick. Only invoked when 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().
Returning 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."
The base implementation returns false (unrecoverable), which is the correct default for strategies that do not implement overrun recovery.

Definition at line 1501 of file stk_common.h.

1502 {
1503 STK_UNUSED(task);
1504 return false;
1505 }
#define STK_UNUSED(X)
Explicitly marks a variable as unused to suppress compiler warnings.
Definition stk_defs.h:715

References STK_UNUSED.

◆ OnTaskSleep()

virtual void stk::ITaskSwitchStrategy::OnTaskSleep ( IKernelTask * task)
pure virtual

Notification that a task has entered sleep/blocked state.

Parameters
[in]taskPointer to the sleeping task,
Note
Sleep API. Implementations shall remove the task from runnable set here.

Implemented in stk::sched::SwitchStrategyEDF, stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyMonotonic< TStrategyType >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::SwitchStrategyMonotonic< TStrategyType >, stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::SwitchStrategyRoundRobinT< NoSleepYield >, and stk::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >.

◆ OnTaskTimeSlice()

virtual bool stk::ITaskSwitchStrategy::OnTaskTimeSlice ( IKernelTask * task)
inlinevirtual

Notification that the running task's time slice expired (KERNEL_TIMESLICE only).

Parameters
[in]taskPointer to the running task, currently in the runnable set.
Returns
true if the strategy rotated to a same-priority peer (the following GetNext() returns it); false to keep running the task (no peer, or the task is not eligible for time-slicing).
Note
Unlike OnTaskYield() this must not release preemption-threshold style holds.
Called from the tick handler. Only invoked when TIMESLICE_API == 1.
See also
SwitchStrategyPreemptionThreshold::OnTaskTimeSlice

Reimplemented in stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, and stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >.

Definition at line 1475 of file stk_common.h.

1476 {
1477 STK_UNUSED(task);
1478 return false;
1479 }

References STK_UNUSED.

◆ OnTaskWake()

virtual void stk::ITaskSwitchStrategy::OnTaskWake ( IKernelTask * task)
pure virtual

Notification that a task is becoming runnable again.

Parameters
[in]taskPointer to the waking task
Note
Sleep API. Implementations shall re-insert the task into the runnable set here.

Implemented in stk::sched::SwitchStrategyEDF, stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyMonotonic< TStrategyType >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::SwitchStrategyMonotonic< TStrategyType >, stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::SwitchStrategyRoundRobinT< NoSleepYield >, and stk::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >.

◆ OnTaskWeightChange()

virtual void stk::ITaskSwitchStrategy::OnTaskWeightChange ( IKernelTask * task,
Weight old_weight )
inlinevirtual

Notification that a runnable task's scheduling weight has changed.

Parameters
[in]taskThe task whose weight was just updated via SetWeight().
[in]old_weightThe previous weight of this task (required to remove it from the priority list belonging to that weight).
Note
Called for any bound task, including a sleeping one (e.g. SetWeight() on it), so the strategy must not assume the task is in its runnable set. The strategy must reflect the new weight in its data structures. For strategies with WEIGHT_API = 0 this is a no-op. For SwitchStrategyFixedPriority it moves a runnable task from its old priority-level list to the new one and updates m_ready_bitmap.
Called from within a critical section (see hw::CriticalSection).

Reimplemented in stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, and stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >.

Definition at line 1518 of file stk_common.h.

1519 {
1520 STK_UNUSED(task);
1521 STK_UNUSED(old_weight);
1522 }

References STK_UNUSED.

◆ OnTaskYield()

virtual bool stk::ITaskSwitchStrategy::OnTaskYield ( IKernelTask * task)
inlinevirtual

Notification that the running task called Yield() (non-HRT kernel modes only).

Parameters
[in]taskPointer to the yielding task, currently in the runnable set.
Returns
true if the strategy handled the yield itself: the task stays runnable (it is NOT put to sleep) and the strategy must arrange for the following GetNext() to return another task according to its own policy; false (default) if the kernel shall perform the legacy yield, i.e. sleep the task for YIELD_TICKS.
Note
Called from within a critical section, in the context of the yielding task.
Never called in KERNEL_HRT mode, where Yield() signals job completion.
See also
SwitchStrategyPreemptionThreshold::OnTaskYield

Reimplemented in stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::SwitchStrategyRoundRobinT< NoSleepYield >, and stk::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >.

Definition at line 1460 of file stk_common.h.

1461 {
1462 STK_UNUSED(task);
1463 return false;
1464 }

References STK_UNUSED.

◆ RemoveTask()

virtual void stk::ITaskSwitchStrategy::RemoveTask ( IKernelTask * task)
pure virtual

Remove task.

Note
Kernel tasks are removed from the concrete implementation of IKernel.
Parameters
[in]taskPointer to the task to remove.

Implemented in stk::sched::SwitchStrategyEDF, stk::sched::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32 >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 32, true >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64 >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyFixedPriority< 64, true >, stk::sched::SwitchStrategyMonotonic< TStrategyType >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_DEADLINE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyMonotonic< MSS_TYPE_RATE >, stk::sched::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32 >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 32, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64 >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyPreemptionThreshold< 64, true >, stk::sched::SwitchStrategyRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< false >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategyRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< false >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::sched::SwitchStrategySmoothWeightedRoundRobinT< true >, stk::SwitchStrategyFixedPriority< MAX_PRIORITIES, NoSleepYield, ReadyBitmap >, stk::SwitchStrategyMonotonic< TStrategyType >, stk::SwitchStrategyPreemptionThreshold< MAX_PRIORITIES, TIMESLICE, ReadyBitmap >, stk::SwitchStrategyRoundRobinT< NoSleepYield >, and stk::SwitchStrategySmoothWeightedRoundRobinT< NoSleepYield >.


The documentation for this class was generated from the following file: