OS_RESUME_IMMEDIATELY Definition

When multiple tasks are in a ready state and share the same priority, a Round-Robin algorithm is employed to activate the task that has not been executed for the longest period. This ensures an equitable distribution of CPU time among all tasks ready for execution.

Unlike many contemporary RTOS implementations that simply append tasks to the end of the ready-to-run queue, this scheduler specifically selects the task with the longest elapsed time since its last execution. For example, when osSleep(25) is called, the task is blocked for the specified duration; once released, it will execute immediately if all other ready tasks of the same priority have already been executed at least once. This behavior applies to all Sirius RTOS features except for task creation and resumption via the osCreateTask and osResumeTask functions. These functions are intended for specific purposes, such as initial task instantiation or task activation following an interrupt. The system configuration determines whether tasks in these specific cases are added to the beginning or the end of the ready-to-run queue. To place them at the beginning of the queue for immediate execution, set the OS_RESUME_IMMEDIATELY constant to 1; otherwise, set it to 0.

The default value is 0, meaning resumed and newly created tasks are appended to the end of the queue. While this provides predictable behavior, setting the value to 1 can improve performance by allowing immediate task processing. This feature should be used with caution: if interrupts are generated frequently, prioritizing these tasks may starve other tasks operating under the Round-Robin scheme.

Version:1.0
See also: osCreateTask, osResumeTask, osSleep, scheduling
SpaceShadow documentation