vTaskSuspend() API function


the mastering FreeRTOS pdf page 92 says:

“Most applications do not use the Suspended state”

Why?, would not be this convenient to reduce the CPU load due to fewer tasks in the scheduler?, we have many tasks running in a PIC32, so when we want to disable some functionalities like a temperature sensor we suspend the task and resume it later, we assume that this procedure reduces CPU load and consumption, is this right?

if you could recommend a document, book, video or any source of learning about this, thanks

That is taking about the Suspend state for a TASK, not the processor. Note, that Suspending the task causes virtually no change in processor load, as those cycles will now go to some other task, and if no where else, to the IDLE task. It is more normal for the task to block on some operation, like a semaphore or direct to task notification to make it wait.

What can be done is use forms of Tickless IDLE to detect when the processor shouldn’t be needed for awhile and go to low power mode. If the processor has a ‘Lower Power Wait for Interrupt’ adding that to an Idle Hook can also save you power.

1 Like


Where did you get that info, is there a manual, document, or book which talks about this?

It is basic principles of how processors work. Suspending one task doesn’t make the processor work less, it just gives time to other tasks, and if no one else wants the time, the Idle task will run. Unless you modify the Idle task (maybe by using the idlehhok), suspending task won’t save power.
And it doesn’t matter if the task is suspended or if it is blocked on something, you just need tasks that don’t have something to do to block until they do. Using blocking actions is almost always easier then suspending, as suspending tasks has a number of race conditions you need to watch out for.