Understanding the scheduler
This section presents the scheduler in more depth, including: the four states a task can be in, the Idle task, how the scheduler is run, and the scheduler architecture.
Understanding FreeRTOS task states
As explained in Chapter 6, Understanding RTOS Tasks, all of the context switching between tasks happens in the background, which is very convenient for the programmer responsible for implementing tasks. This is because it frees them from adding code into each task that attempts to load-balance the system.
Tasks can be in one of four states: running, ready, blocked, and suspended. The state transitions are modeled using a state machine, as shown below. Each transition is the result of either a FreeRTOS API call made by your code, or an action taken by the scheduler when it is called from the SysTick ISR.

Figure 7.8 : FreeRTOS Task States
Let’s look at the states one by one.
Running
Only one task can be in the Running...