Scheduler and Task Management

The criterion. The scheduler must guarantee execution timelines: preemptive fixed-priority scheduling (the industry standard), plus round-robin or time-triggered options, with deterministic, predictable context-switch and interrupt latency.

How Revera answers it

Revera schedules preemptive fixed-priority by default, with round-robin among equal priorities and an optional EDF (earliest-deadline-first) policy. Priority is an explicit number in [TK_PRIO_MIN, TK_PRIO_MAX] (0..255), not a vague level — higher preempts lower, equal round-robins. On the MCU ports a timer interrupt can switch at any instant; on the desktop the same code runs cooperatively. Every port provides its own O(1)-style ready selection; the exact context-switch cycle count is a per-target property (measure it — Revera does not publish a number it cannot back on your silicon).

Feature · how to turn it on · how to use it · where it works

Feature

Turn on with

Use these APIs

Where

Preemptive fixed-priority

default

tk_thread_create / tk_thread_spawn (priority arg), TK_PRIO_MIN / TK_PRIO_MAX

all

Round-robin (equal priority)

default

tk_thread_set_quantum (time slice)

all

Cooperative mode

tk_kernel_set_preempt_mode(TK_COOPERATIVE)

tk_thread_yield

all

EDF (deadline-driven)

TK_CONFIG_ENABLE_EDF + tk_kernel_set_sched_policy(TK_SCHED_EDF)

tk_thread_set_deadline

all

Sleep / yield (blocking, not busy-wait)

—

tk_sleep_ms, tk_thread_yield

all

Thread lifecycle

—

tk_thread_create / spawn / exit / join / detach / self

all

Per-thread config

setup

tk_thread_set_quantum / set_privileged / set_affinity / pin

all

Full signatures and contracts: API reference — Threads / Kernel lifecycle.

Limits & roadmap

  • Context-switch / interrupt-latency cycle counts are not published — they are arch- and board-specific; measure on your target. A tickless / time-triggered mode is not in 0.1.0.

  • EDF is optional and off by default (fixed-priority is the safe, deterministic default).

Learn more