FreeRTOS Scheduler and Scheduling Policy

Hi, I am trying to understand how the FreeRTOS Scheduler works. The tasks.c file has comments in it, however, is there a good starting point that I can see to understand:

  • How the Scheduler works
  • What Scheduling policy it uses
  • How the tasks are put to a blocked state
  • How the real-time guarantees are given, etc?

Any leads or answers to the above questions would be very helpful. Thank you!

There are some “books” available that go into more details, a good place to start is use the web-site navigation a look at Kernel / Getting Started.

The simple answers:

The Scheduling policy is run the Highest Priority task that is ready. In case of tie, the one that has been waiting the longest.

When a task blocks, it is put on a list connected to the thing it blocked on so that when that thing gets “triggered” the system can unblock the task(s) that need to be. There is also a list of task sorted by the time they will get unblocked by time (for delays or timeouts on other blocks).

FreeRTOS itself, doesn’t do anything about actual real-time guarantees. You, the programmer need to design your system to meet the requirements using the tools provided. FreeRTOS CAN’T guarantee that a task will meet its requirement, as the task (or the system) might not have the time it needs to meet it. YOU need to make sure your tasks have appropriated bounded execution times, and then put them in a priority order that will let you tasks meet their requirements.

This is the link to the book @richard-damon mentioned above - https://www.freertos.org/fr-content-src/uploads/2018/07/161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf

This page describes the algorithm: FreeRTOS single-core AMP and SMP RTOS task scheduling - FreeRTOS

Thank you for all the leads!