Hardware Reference
In-Depth Information
There are two primitives for terminating a process: the first, called
end process
, di-
rectly operates on the calling task; the other one, called
kill
, terminates the task passed
as a formal parameter. Note that if the task is HARD, it is not immediately removed
from the system but put in ZOMBIE state. In this case, the complete removal will be
done by the timer routine at the end of the current period:
/*-----------------------------------------------------------*/
/* end process -- terminates the running task */
/*-----------------------------------------------------------*/
void
end process
(void)
{
<disable cpu interrupts>
if (vdes[pexe].type == HARD)
insert(pexe, &zombie);
else
vdes[pexe].state = FREE;
insert(pexe, &freetcb);
dispatch();
load context();
}
Search WWH ::
Custom Search