Skip to main content

Process vs thread and task states

Short answer

A process has separate memory space; a thread shares its process's memory but has own stack and registers. Task states: Ready (waiting for CPU, e.g., periodic keypad scan), Running (executing, e.g., scanning keys), Blocked (waiting for event, e.g., UART byte), Dormant (terminated/not created). Transitions occur via scheduler dispatch, preemption, wait, and event signals.

Distinguish between process and thread. Write different states of task with appropriate example.

Process versus thread

PointProcessThread
DefinitionProgram in execution with its own resourcesLightweight execution path inside a process
MemorySeparate address spaceShares the address space of its process
Creation / switchingSlow, heavyFast, light
CommunicationThrough IPC mechanismsThrough shared variables
IsolationHighLow (one thread fault can kill the process)
ResourcesOwn files, data, stack, registersOwn stack and registers only

States of a task

A task passes through these states in an RTOS:

            create              dispatch
 (New) ---------> [Ready] <--------------> [Running]
                    ^   pre-empt/time slice   |
                    |                         | wait for event/I/O/delay
          event occurs                        v
                    +----------------- [Blocked/Waiting]
 Running --terminate--> [Terminated/Dormant]
  • Ready: the task is able to run and waits for the CPU. Example: a keypad-scan task whose period has elapsed.
  • Running: the CPU is executing the task's instructions (only one task per CPU). Example: the keypad-scan task while it is reading the keys.
  • Blocked (waiting): the task waits for an event, semaphore, message or delay; it becomes ready when the event occurs. Example: a task waiting for a UART byte.
  • Suspended / Terminated (dormant): the task has been deleted or not yet started, and is not scheduled.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Embedded System chapter 6 questions →