Task states and execution
Last updated
Last updated
Association between executable code (e.g. a “C” language function) to a private variable space (private stack) and a management structure - task control block (TCB).
Concurrent execution of the task’s code, using the respective private variable space, under control of the RTOS kernel. The RTOS kernel is responsible for activating each one of the task’s jobs, when:
A period has elapsed (periodic).
An associated external event has occurred (sporadic).
Execution of task instances (jobs).
After being activated, task’s jobs wait in a queue (the ready queue) for its time to execute (i.e., for the CPU).
The ready queue is sorted by a given criterion (scheduling criterion). In real-time systems, most of the time this criterion is not the arrival order!
Task instances may be waiting for execution (ready) or executing. After completion of each instance, tasks stay in the idle state, waiting for its next activation.
Thus, the basic set of dynamic states is: idle, ready and execution.
Other states: blocked.
Whenever an executing task tries to use a shared resource (e.g. a memory buffer) that is already being used in exclusive mode, the task cannot continue executing. In this case it is moved to the blocked state. It remains in this state until the moment in which the resource is released. When that happens the task goes to the ready state.
Other states: self suspension (sleep).
In certain applications tasks need to suspend their execution for a given amount of time (e.g. waiting a certain amount of time for a packet acknowledgment), before completing their execution. In that case, tasks move to the suspended state.