---
title: "Different states of a task"
subject: "Embedded System"
chapter: 6
key: "semester_6/embedded_system:task-states"
source: https://www.bctengineer.com/q/semester_6/embedded_system/task-states
site: BCT Engineering
---

# Different states of a task

Embedded System · Chapter 6: RTOS

- Asked in: 2078 Chaitra
- Video: [7 Task states](https://www.youtube.com/watch?v=3JcVC7hDh4U) — Ahmed Elserafy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/embedded_system/task-states
- Whole chapter: https://www.bctengineer.com/md/semester_6/embedded_system/chapter-6

## Question

Briefly explain the different states of a task.

## Short answer

Task states: Dormant (not created/terminated), Ready (able to run, queued), Running (executing on CPU), Blocked (waiting for event/I/O/semaphore), Suspended (explicitly stopped). Transitions: Ready→Running (dispatch), Running→Ready (preemption), Running→Blocked (wait), Blocked→Ready (event), Running→Dormant (exit).

## Answer

In an RTOS a task moves between a few states under the control of the scheduler:

```text
 Create -> [Ready] --dispatch--> [Running] --finish--> [Dormant]
              ^  <--pre-empt--       |
              |                      | wait (delay, semaphore, I/O)
              +------ event ---- [Blocked]
```
1. **Dormant / New:** the task's code is in memory, but the task has not been created yet (or it has been deleted/terminated). It is not scheduled.
2. **Ready:** the task is able to run and is in the ready queue, waiting for the CPU because a higher-priority task is running.
3. **Running:** the CPU is executing the task; in a single-CPU system only one task is running.
4. **Blocked (waiting):** the task cannot continue until an event happens, such as an I/O completion, a delay expiring, a semaphore or a message. It leaves the ready queue.
5. **Suspended** (in some RTOS): the task is explicitly stopped by a call and resumes only when another task resumes it.

Transitions: ready to running (dispatched by the scheduler), running to ready (pre-empted or time slice over), running to blocked (waits), blocked to ready (event occurs), running to dormant (task ends).

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What moves a task from the Blocked state back to Ready?
   A. The scheduler's time slice ends
   B. The awaited event (I/O completion, delay expiry, semaphore) occurs
   C. The task is dispatched by the scheduler
   D. A higher-priority task is created
   Answer: B. A blocked task leaves the ready queue until the event it waits for happens; then it becomes ready. (Key point: Blocked to ready)

2. Which cause sends a task from Running back to Ready?
   A. Pre-emption or end of time slice
   B. Waiting for a semaphore
   C. Calling delay()
   D. Finishing its code
   Answer: A. Pre-emption or time-slice expiry returns a still-runnable task to the ready queue; waiting makes it blocked. (Key point: Running to ready)

3. How does the Suspended state differ from Blocked?
   A. Suspended exits automatically when an event occurs
   B. Suspended means the task is running
   C. Suspended tasks are in the ready queue
   D. Suspended is entered by an explicit call and exits only when another task resumes it
   Answer: D. A suspended task is explicitly stopped and is resumed only by another task, not by an event. (Key point: Suspended state)

## Related in Embedded System

- [Process vs thread and task states](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Aprocess-thread-and-task-states) — Embedded System, chapter 6
- [Scheduler and task states](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Ascheduler-task-states-role) — Embedded System, chapter 6
