Problem: recall that each process in Penn OS is implemented by a ucontext
instance.
An instance of ucontext_t
has the uc_link
field. When the context's main function (the one set by makecontext
) finishes
and uc_link
is NULL
, then the whole Penn OS finishes and this is clearly not what we want.
Therefore, we want to have a cleanup_context
(either one global or one for each process) such that we have
uc_link = cleanup_context
. The cleanup_context
would perform cleanup (among other things set the state of the process
to ZOMBIE
) and then invoke the scheduler to schedule a new process.