High-Resolution Scheduling
KideRT programs the hardware timer for the next scheduled event, so timed wakeups are not rounded up to a tick.
Thread asleepThread runsTimer interrupt
For a 4.2 ms sleep, High-Resolution Scheduling sets the timer for 4.2 ms, and the thread wakes after 1 timer interrupt. Tick-Resolution Scheduling rounds the wakeup up to 5 ms, the next tick, after 5 timer interrupts.
From timer event to thread execution
Timed wakeups follow scheduled events. Application execution also depends on interrupt handling and the scheduler.
Handling an expiry is O(1): the work does not grow with the number of timers armed.
Read about O(1) system callsChoose the next timed event
KideRT uses the next scheduled event to determine when the hardware timer should expire.
Process the timer expiry
KideRT handles the event and makes any waiting work eligible to run.
Dispatch eligible work
The scheduler selects which ready thread runs, by priority and scheduling policy. Other work and interrupt activity affect when execution begins.
Tickless by design
A tick-based kernel runs a timer interrupt at a fixed rate, commonly 1 kHz on Cortex-M, and counts time in ticks. Three things follow, whatever the rate.
High-Resolution Scheduling is tickless scheduling: KideRT has no periodic tick, idle or busy. The hardware timer is set for the next event, a sleep’s end, a timer’s expiry or the end of a time slice, and the resolution is that of the timer the port uses. A tick-based kernel’s tickless mode is a different thing: it suppresses the tick while idle and still rounds every wakeup to the tick.
Read the deep dive: High-Resolution vs. Tick-Resolution Scheduling- Resolution
- A tick-based kernel rounds a request up to the next tick: 2.3 ms becomes 3 ms, and where in the tick period the request was made adds up to one tick more. KideRT sets the timer for 2.3 ms. A sub-millisecond period, such as 250 µs, is out of reach with a 1 ms tick; on KideRT it is set like any other.
- Interrupts
- Its tick fires whether or not anything is due, so a thread asleep for 5 ms is interrupted five times on its way there. On KideRT it is interrupted once, at 5 ms.
- The rate
- A faster tick narrows the rounding and multiplies the interrupts, and the rate is chosen once for the whole application. KideRT has no rate to choose, because the resolution is the timer’s.
Scheduling policies
KideRT schedules threads preemptively by priority. A thread that becomes ready preempts a running thread of lower priority, and a higher value is a higher priority. Each thread’s scheduling policy decides how it shares the processor with threads of equal priority. Priorities and policies are set per thread through the POSIX thread attributes.
Read the scheduler documentation- Round-Robin Scheduling
- The default policy. Threads of equal priority take turns, each running for a fixed time slice. When its slice expires, a thread goes behind the other ready threads of its priority. A preempted thread resumes first and runs the rest of its slice.
- FIFO Scheduling
- The highest-priority ready thread runs, with no time slicing among threads of equal priority. A preempted thread resumes before the other ready threads of its priority.
Scheduling and timing questions
Does timer resolution tell me when my thread will run?
No. Timer resolution is the granularity with which the configured timer can represent time, set by the timer clock and its configuration. Interrupt activity, thread priorities, critical sections and competing work also affect when the thread resumes.
Is High-Resolution Scheduling the same as a tickless kernel?
In the literal sense, yes. KideRT has no periodic tick. Sleeps, timers and the time slices of Round-Robin Scheduling are all timed events, and the hardware timer is set for whichever comes next. The tickless mode of a tick-based kernel is a different thing. It stops the tick only while idle and still rounds every wakeup to the tick.
What resolution does High-Resolution Scheduling give?
That of the hardware timer the port uses: its clock and configuration. It is a property of the target, not a figure KideRT fixes, and it says how finely a time can be set, not when the thread runs.
How do I check timing under application load?
Measure the delay from the timer event to the thread resuming on your target hardware.
Does a high-resolution wakeup guarantee a deadline?
A completion deadline also depends on execution time, interference and the application’s scheduling assumptions. Evaluate the full workload against its deadlines.
Timing requirements
Discuss your target, workload and deadlines with our engineers.