As explained in Chapter 2, 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. While the task code isn't explicitly performing the task state transitions, it is interacting with the kernel. Calls to the FreeRTOS API cause the kernel's scheduler to run, which is responsible for transitioning the tasks between the necessary states.
Understanding FreeRTOS task states
Understanding different task states
Each transition shown in the following state diagram is caused by either an API call being...