- 2070 Magh · 6 marks
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
| Point | Process | Thread |
|---|---|---|
| Definition | Program in execution with its own resources | Lightweight execution path inside a process |
| Memory | Separate address space | Shares the address space of its process |
| Creation / switching | Slow, heavy | Fast, light |
| Communication | Through IPC mechanisms | Through shared variables |
| Isolation | High | Low (one thread fault can kill the process) |
| Resources | Own files, data, stack, registers | Own 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)
Related questions
- Different states of a task · Embedded System, chapter 6
- Scheduler and task states · Embedded System, chapter 6
- Process versus thread differences · Embedded System, chapter 6 · asked 4×
- Process vs thread; multithreading advantages · Operating System, chapter 2
- What is process; process vs thread · Operating System, chapter 2
- Process vs thread; context switching · Operating System, chapter 2
- Process vs thread; user and kernel threads · Operating System, chapter 2