# Task States in RTOS

**URL:** <https://forums.freertos.org/t/task-states-in-rtos/18326>\
**Category:** Kernel\
**Created:** [October 14, 2023, 4:03pm UTC](https://forums.freertos.org/t/task-states-in-rtos/18326 "2023-10-14T16:03:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mtech](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Mtech](https://forums.freertos.org/u/Mtech)\
**Post date:** [October 14, 2023, 4:03pm UTC](https://forums.freertos.org/t/task-states-in-rtos/18326/1 "2023-10-14T16:03:55Z")

</div>

Hi,

I have looked at the information given [Here](https://www.freertos.org/RTOS-task-states.html) , and I now understand the concepts of the Running, Ready, and Blocked states in an RTOS. Running is when a task is actively executing, Ready is when a task is waiting its turn, and Blocked is when a task is waiting for a specific event.

For example, in a real-time control system, a task controlling motor movements is in the Running state, while other tasks for different controls (e.g., sensor data processing) might be Ready, waiting for their turn. Additionally, a task in an industrial automation system that’s waiting for scheduled sensor readings at fixed time intervals (e.g., every 10 milliseconds) represents an example of the Blocked state.

I’m having trouble understand the Suspended state. I am looking for a real use case or example that helps me understand the concept of suspended tasks.

Thank you!

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [October 14, 2023, 4:29pm UTC](https://forums.freertos.org/t/task-states-in-rtos/18326/2 "2023-10-14T16:29:35Z")

</div>

The difference between “Blocked” and “Suspended” is that a task in the “Blocked” state will automatically start after a timeout period, while a task is “Suspended” state will not.

A Task will end up in “Suspended” state if either it is the target of a vTaskSupsend() call, or it it makes a call to an API with a timeout parameter of configMAX\_DELAY (it used to also require INCLUDE\_vTaskSuspend to be 1, not sure if that is still required). In the case of a configMAX\_DELAY API call, the task will still wake up when the required condition occurs. It might also wake up if some task aborts its delay or resumes it (I think).

---

<div class="post-metadata">

**Author:** ![Mtech](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Mtech](https://forums.freertos.org/u/Mtech)\
**Post date:** [October 15, 2023, 2:42am UTC](https://forums.freertos.org/t/task-states-in-rtos/18326/3 "2023-10-15T02:42:25Z")

</div>

> [@richard-damon](#):
>
> sure if that is still required). In the case of a configMAX\_DELAY API call, the task will still wake up when the required condition occurs. It might also wake up if some task aborts its delay or resumes it (I think).

Thank you. As I provided examples of the Ready, Running, and Blocked states, could you please offer a practical use case of a Suspended task?

I’m looking for a scenario that helps me understand why it might be necessary to suspend a task and the benefits of doing so

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [October 15, 2023, 2:57am UTC](https://forums.freertos.org/t/task-states-in-rtos/18326/4 "2023-10-15T02:57:58Z")

</div>

Say you want to wait on a queue until something arrives, and not have the task woken up just because it took to long. Then you use a wait time of configMAX\_DELAY, and the task will not be woken until something is put on the queue.

As I said before, the difference is that going into a “Blocked” state, says that after some defined timeout, even if the event doesn’t happen, the task is woken. While with the suspend state, there is no timeout operating, the task will wait until the event happens (or some special call that ends the wait).

Actually using vTaskSuspend directly is very uncommon. With the current direct-to-task notifications, most of the even rare cases are removed, but it could be used (with extreme care) as a way for a task to stop itself (or even rarer another task) until another task decided it was time to be worked up without needing the overhead of a semaphore.
