Running to suspended state

I can’t imagine a situation in real application where task goes from Running state to suspended state.

What are the situation in your real world application where task goes from Running state to suspended state?

Like a task blocking on a queue to wait for input, when it doesn’t need a timeout if nothing comes after a period of time.

“Suspended” Means the task has stopped, and won’t be automatically woken up just by the passage of time.

Now, if you mean calling vTaskSuspend, that is admittedly not something I expect many programs need to use. It is mostly a hold over for a simple, low over head, synchronization system, but one that requires a lot of care to get right. Most of those would be better service with a semaphore or a direct-to-task notification.

1 Like

Update: Below discusses an application level use of the ‘suspended’ state. @richard-damon provided a very solid answer explaining a more typically FreeRTOS use case of the suspended state.

One additional use of suspended state is for low power devices - think backpacking dataloggers, tracking beacons, etc - which spend much of their time suspended. This is done to save power as processing, transfer, storing are needed infrequently.

For example I have a GPS tracker for when I go backpacking and I’ve set the device to log my location every hour. It lies dormant (aka suspended) for the overwhelming majority of the hour until it kicks awake to fetch and upload my GPS coordinates wirelessly. By remaining dormant, the device can function for many days draining the battery as little as possible.

1 Like