next up previous
Next: Process Creation Up: Implementation Previous: Implementation

Tasks Performed

(Error checking, ensuring mutual exclusion while accessing process table, and other functions common to resume and suspend will not be mentioned in the remaining implementation descriptions)

returns stack space.

frees process table entry, making it available for reuse.

remove process from any list it is on,

increments semaphore count if necessary,

reschedules if process killed itself. reschedule needs the ``freed'' process stack for passing arguments to ctxsw. Fortunately, this is not a problem, since interrupts are disabled between the time the stack is freed and ctxsw finishes processing the arguments. As a result, the freed stack will not be overwritten by another process while the arguments are accessed.

Incrementing the semaphore count in terminate violates the layering principle as process management is now aware of process coordination. In general, layered systems often have to resort to upaccesses, which are accsses to higher level layers. These upaccesses should reveal as little details of the higher level layers as possible if the benefits of layering are to retained. It is possible to do better than the Xinu implementation by having each higher level layer register a cleanup routine that is called by process management rather than access the higher-level semaphore table directly. The cleanup routine can then deallocate resources it created. (Why is this approach better than the Xinu implementation?)



Prasun Dewan
Tue Jan 20 11:58:31 EST 2004