Discussion:
Reaper Thread
(too old to reply)
c***@CSIC.UMD.EDU
2005-10-11 13:41:08 UTC
Permalink
Reaper Thread start with being at Level 0.
If i spawn null.exe it starts to execute because it is also at
level 0 but then it is demoted once its quantum expires.

Now the only thread that is running in level 0 is the reaper,
because it calls yield on itself before the quantum expires it
remains on level 0. So everything get_next_runnable is called it
will find the repear thread and null will never get the quantum.

Please let me know what am i doing wrong ?
David Marcin
2005-10-11 17:10:45 UTC
Permalink
According to the spec it doesn't seem like you've done anything wrong.
However, since we probably don't want "yield" to turn into a way to
never yield to other processes, the design decision to cause yield to
move you to a lower MLF scheduling level seems reasonable. Can we get
an official comment on this since that doesn't appear in the MLF rules
in the spec?
Post by c***@CSIC.UMD.EDU
Please let me know what am i doing wrong ?
c***@CSIC.UMD.EDU
2005-10-11 17:17:07 UTC
Permalink
But pushing it down in the priority level when yielding does not
seem to be reasonable too. This way, the reaper thread will soon
get to bottom preference level, also, it will only clear memory
for those thread that are there in graveyard only when there are
no other runnable threads remaining in the system.

I dont know if thats such a good idea.

But i am still wondering what to do on this. So any help is
appreciated.
David Marcin
2005-10-11 17:57:55 UTC
Permalink
This is not really as big a problem as it sounds. It is true that it
will move to the lowest level but it will then share time with all other
runnable processes on that level. It will not get starved out of time
by other processes unless they exist on priority levels above itself.
At this point only a few things can happen: processes will move down to
the lowest level and share time with the reaper, or, they will die and
the reaper will have no runnable processes above it, or, they will
block, and the reaper will have no runnable processes above it. I think
that's it, so having the reaper on the lowest priority shouldn't be a
problem.

I guess you could be in trouble if someone wrote a process that
repeatedly forked and died in under 1 or 2 quanta though...but I don't
think we provide that functionality.
Post by c***@CSIC.UMD.EDU
But pushing it down in the priority level when yielding does not
seem to be reasonable too. This way, the reaper thread will soon
get to bottom preference level, also, it will only clear memory
for those thread that are there in graveyard only when there are
no other runnable threads remaining in the system.
Iulian Neamtiu
2005-10-11 17:51:28 UTC
Permalink
Yes, it calls Yield, it gets rescheduled, runs, and then it blocks by
doing an:
Wait(&s_reaperWaitQueue);
at this point it's taken off the runqueues, hence the other threads can
run. Unlike the Idle thread, the Reaper thread only wakes up when
there's some dead thread that needs to be cleaned up.

Iulian
Post by c***@CSIC.UMD.EDU
Reaper Thread start with being at Level 0.
If i spawn null.exe it starts to execute because it is also at
level 0 but then it is demoted once its quantum expires.
Now the only thread that is running in level 0 is the reaper,
because it calls yield on itself before the quantum expires it
remains on level 0. So everything get_next_runnable is called it
will find the repear thread and null will never get the quantum.
Please let me know what am i doing wrong ?
Loading...