Hardware Reference
In-Depth Information
/*-----------------------------------------------------------*/
/* schedule -- selects the task with the earliest deadline */
/*-----------------------------------------------------------*/
void
schedule
(void)
{
if (firstdline(ready) < vdes[pexe].dline)
{
vdes[pexe].state = READY;
insert(pexe, &ready);
dispatch();
}
}
/*-----------------------------------------------------------*/
/* dispatch -- assigns the cpu to the first ready task */
/*-----------------------------------------------------------*/
void
dispatch
(void)
{
pexe = getfirst(&ready);
vdes[pexe].state = RUN;
}
The timer interrupt handling routine is called
wake up
and performs the activities de-
scribed in Section 10.4.1. In summary, it increments the
sys clock
variable, checks for
the system lifetime and possible deadline misses, removes those tasks in zombie state
whose deadlines are expired, and, finally, resumes those periodic tasks in idle state at
the beginning of their next period. Note that if at least a task has been resumed, the
scheduler is invoked and a preemption takes place.
Search WWH ::
Custom Search