Hardware Reference
In-Depth Information
WAIT
signal
wait
dispatch
activate
terminate
READY
RUN
preemption
resume
end_cycle
IDLE
TIMER
Figure 10.2
Minimum state transition diagram of a real-time kernel.
Running . A task enters this state as it starts executing on the processor.
Ready . This is the state of those tasks that are ready to execute but cannot be
executed because the processor is assigned to another task. All tasks that are in
this condition are maintained in a queue, called the ready queue .
Waiting . A task enters this state when it executes a synchronization primitive to
wait for an event. When using semaphores, this operation is a wait primitive on a
locked semaphore. In this case, the task is inserted in a queue associated with the
semaphore. The task at the head of this queue is resumed when the semaphore is
unlocked by another task that executed a signal on that semaphore. When a task
is resumed, it is inserted in the ready queue.
In a real-time kernel that supports the execution of periodic tasks, another state must
be considered, the IDLE state. A periodic job enters this state when it completes its
execution and has to wait for the beginning of the next period. In order to be awakened
by the timer, a periodic job must notify the end of its cycle by executing a specific
system call, end cycle , which puts the job in the IDLE state and assigns the processor
to another ready job. At the right time, each periodic job in the IDLE state will be
awakened by the kernel and inserted in the ready queue. This operation is carried out
by a routine activated by a timer, which verifies, at each tick, whether some job has to
be awakened. The state transition diagram relative to the four states described above
is shown in Figure 10.2.
Additional states can be introduced by other kernel services. For example, a delay
primitive, which suspends a job for a given interval of time, puts the job in a sleeping
state (DELAY), until it is awakened by the timer after the elapsed interval.
Search WWH ::




Custom Search