
CHAPTER 4 TASK MANAGEMENT
User’s Manual U14833EJ2V0UM
36
4.6
Task States
The task changes its state according to how resources required to execute the processing are acquired, whether
an event occurs, and so on. Task states are always managed by the kernel, which performs the processing required
according to that state. The seven states applicable to tasks are described below.
(1) Non-existent
A task in this state has not been created or has been deleted, and is not registered in the kernel. A task in the
non-existent state is therefore not managed by kernel even though its code is located in memory.
(2) Dormant
A task in this state has just been created or has already completed its processing. A task in the dormant state
is not subject to scheduling by the kernel, even though it is under the kernel’s management.
(3) Ready
A task in this state is ready to perform its processing, but has been waiting to be assigned the right to use the
CPU (execution right) because another task with the same or higher priority is being executed.
A task in the ready state is subject to scheduling by the kernel, and can be shifted to the running state as soon
as it receives the execution right.
(4) Running
A task in this state has been assigned the execution right and is either currently performing its processing or
has had its processing interrupted while an interrupt service routine or handler is being executed.
Within the entire system, only a single task can be in the running state at any one time.
(5) Waiting
A task in this state has been stopped because the requirements for performing its processing, such as the
acquisition of a semaphore or memory block, have not been satisfied. The processing of this task is resumed
from the point at which it was stopped. At this time, the data (context) required to execute the program is
restored to the state it was in immediately before the stoppage. The acquisition status, etc., of resources that
are unrelated to the wait are not affected by the stoppage/resumption of execution.
The waiting state is further divided into the following types of states, according to the wait source. For further
details of these states, refer to the next and subsequent chapters.
Type
Waiting for:
Service call Causing Wait
Wake-up wait
Reception of wake-up request
(t)slp_tsk
Time elapse wait
Lapse of time
dly_tsk
Semaphore wait
Acquisition of resource from semaphore
(t)wai_sem
Event flag wait
Establishment of event flag condition
(t)wai_flg
Data transmission wait
Completion of data write to buffer
(t)snd_dtq
Data reception wait
Reception of data
(t)rcv_dtq
Message reception wait
Reception of a message
(t)rcv_mbx
Mutex wait
Locking a mutex
(t)loc_mtx
Fixed-length memory block wait
Acquisition of fixed-length memory block
(t)get_mpf
Variable-length memory block wait
Acquisition of variable-length memory block
(t)get_mpl