yX kernel focus on linear scheduling, meaning that it will run tasks in a time-controlled loop. It is typically used with two cycles, one running in the main loop and a second running on SysTick. Systick on STM32 works well at 1000 times per second using < 1 % CPU load which gives a rather high accuracy in timing.
The trick with this scheme is that our main application will have a stack allocated. As a systick is received the main loop is interrupted and we use the same stack for systick tasks that will finish and reset the stack before the main loop continuous. This technique allows for a much larger scalability in tasks than we otherwise could have achieved.
Correct timing is very important in embedded systems. yX is capable to do timing down to micro seconds (yS), but the designed target is ms. The timing schemes are:
Only if signalled
- Timed intervals
- Average time
- Idle time only
yX implement software timers as tasks. You start a SW timer by setting a task to run in lets say 4 seconds using Timed Intervals. This works as a timer that will cause yX to execute that task in 4 seconds time unless it is switched off.
Queues and events can be implemented similarly by using Signalled task schemes. This scheme will execute the task once for each time it is signalled making it excellent for communication receivers.
Idle time is only possible if we decide how long a cycle is. If we do so we can force the MCU to use fixed idle time length and have tasks that only execute if we have spare time in a cycle.