Hardware Reference
In-Depth Information
The transition RUN-SLEEP is performed by the sleep system call. The running task is
suspended in the sleep state, and the first ready task is dispatched for execution. Note
that this primitive acts on the calling task, which can be periodic or aperiodic. For
example, the sleep primitive can be used at the end of a cycle to terminate an aperiodic
instance.
/*-----------------------------------------------------------*/
/* sleep -- suspends itself in a sleep state */
/*-----------------------------------------------------------*/
void sleep (void)
{ save context();
vdes[pexe].state = SLEEP;
dispatch();
load context();
}
The primitive for terminating a periodic instance is a bit more complex than its ape-
riodic counterpart, since the kernel has to be informed on the time at which the timer
has to resume the job. This operation is performed by the primitive end cycle , which
puts the running task into the idle queue. Since it is assumed that deadlines are at the
end of the periods, the next activation time of any idle periodic instance coincides with
its current absolute deadline.
In the particular case in which a periodic job finishes exactly at the end of its period,
the job is inserted not in the idle queue but directly in the ready queue, and its deadline
is set to the end of the next period.
Search WWH ::




Custom Search