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
SwitchStrategyRoundRobin Class Reference

Round-Robin task-switching strategy: each runnable task receives one time slice (one tick interval) in turn before the kernel moves to the next task. More...

#include <stk_strategy_rrobin.h>

Detailed Description

Round-Robin task-switching strategy: each runnable task receives one time slice (one tick interval) in turn before the kernel moves to the next task.

Internally maintains two intrusive lists:

  • m_tasks — tasks currently eligible for scheduling (runnable).
  • m_sleep — tasks that called Sleep() or are otherwise blocked.

The iterator cursor (m_prev) points to the most recently scheduled task. On each call to GetNext() the cursor advances by one position in m_tasks, wrapping around at the end (closed-loop list). When m_tasks is empty, GetNext() returns nullptr and the kernel transitions to the sleep trap.

Template Parameters
NoSleepYieldIf true, Yield() keeps the task in the runnable set and the strategy rotates the cursor (see OnTaskYield). If false, the kernel performs the legacy yield: the task sleeps for YIELD_TICKS.
Note
All runnable tasks receive equal CPU time regardless of creation order or any other factor. There is no priority or weight mechanism in this strategy (WEIGHT_API = 0).
Requires the kernel Sleep API (SLEEP_EVENT_API = 1): the kernel must call OnTaskSleep() and OnTaskWake() when a task's sleep state changes.
See also
SwitchStrategyRR, SwitchStrategyRR_NSY, ITaskSwitchStrategy

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