
CHAPTER 2 BASIC FUNCTIONS OF RX78K/IV
9
2.1.1
Task state transition
Fig. 2-1 illustrates state transition of a task. Each state transition has the following meaning, and system calls that
places a task in one state from another are available.
(1) Starting
A task is started when it is placed in the READY state from the DORMANT state by a system call.
(2) Terminating
A task is terminated when it is placed in the DORMANT state from the RUN state by a system call.
(3) DISPATCH
Dispatching is to select a READY task to be placed in the RUN state. The task that will be placed in the RUN
state has the highest priority of the tasks in the READY state. Dispatching is also called scheduling, and the
block that executes dispatching or scheduling is called a dispatcher or scheduler.
There are 14 levels of task priorities (2 to 15), with the lowest number assigned the highest priority. Others
include priorities 0 and 1. However, these cannot be specified for tasks because they are reserved for OS.
(4) PREEMPT
When a task having a higher priority than that of the task currently executed is placed in the RUN state, the
currently executed task is once returned to the READY state. The task placed in the READY state from the RUN
state cannot return to the RUN state, unless selected by the dispatcher again.
(5) Wait condition
If there is a necessity to wait for occurrence of an event, a task enters the WAIT state from the RUN state.
A task enters the WAIT state because the task has requested a resource while it was waiting for an event flag to
be set but the requested reception has not been found, the task has requested reception of a message but the
message has not arrived, the task has requested to wait for a fixed time period, but the period has not yet
elapsed, etc.
(6) Wait release
When a task is released from the WAIT state, it is placed in the READY state. In this case, an event is an
occurrence that cancels the factor causing the WAIT state by the system.
(7) Forced termination
A task is forcibly terminated when it is placed in the DORMANT state from a state other than the RUN state by a
system call.