Daniel Ramsbrock
2005-09-18 15:49:19 UTC
OK, let's attempt to finally clear up what we need to do with all of the
queues...
s_runQueue - if a process is here, its state is R. Needs to be checked
for both kills and ps.
any of the I/O queues (I won't list them here since that might be
"giving away too much", but here's a hint: we have one keyboard and two
disk drives right now...) - if a process is here, its state is S. Needs
to be checked during kills, but not necessarily during ps (depending on
how you code it--one approach is to let the default state be S, and then
specifically check for R and Z--if it's neither of those, it must be S)
s_graveyardQueue - from the description and use in kthread.c, it seems
like it's used to briefly hold processes that are being handed over to
the Reaper thread. Is that correct? If so, we will never need to check
it for kills (since they're already dead), but what about the ps
listing? It don't think we need to check it because in the project
description, zombies are defined as " Any process that is dead, but
still has a reference count greater than 0 is called a zombie. That is,
it is dead, but cannot yet be reaped by the reaper. " Therefore, no
zombie processes would ever be in s_graveyardQueue since Reap_Thread
(which is the only place processes are being added to it) only gets
called when refCount == 0 (see Detach_Thread).
s_reaperWaitQueue - it seems like its only purpose is to hold the single
kernel Reaper thread and then have Wake_Up called on it from time to
time to let the Reaper know that there is work to do. Therefore we'll
never have to check it for kills (since the Reaper thread is a kernel
thread that can't be killed). We don't explicitly have to check it for
ps listings (since, as above, if the thread is not in R or Z state, it
must be in S state), but if you are checking queues to determine the S
state, then this one must be included (otherwise pid 3, the Reaper
thread, won't have the proper state). Is all of this correct?
Zombies - as was pointed out before, zombies are not on any queue.
They're dead, so obviously not on the runQueue or any of the I/O queues.
They're also not on the graveyardQueue or the reaperWaitQueue (see
above). However, they are still on the s_allThreadList. A good way to
check for them is to take the description's definition of zombies (see
above) quite literally (is it dead? is its refCount > 0?).
Dr. Hicks and the TA's, please correct any inaccuracies in the above
information.
Daniel
queues...
s_runQueue - if a process is here, its state is R. Needs to be checked
for both kills and ps.
any of the I/O queues (I won't list them here since that might be
"giving away too much", but here's a hint: we have one keyboard and two
disk drives right now...) - if a process is here, its state is S. Needs
to be checked during kills, but not necessarily during ps (depending on
how you code it--one approach is to let the default state be S, and then
specifically check for R and Z--if it's neither of those, it must be S)
s_graveyardQueue - from the description and use in kthread.c, it seems
like it's used to briefly hold processes that are being handed over to
the Reaper thread. Is that correct? If so, we will never need to check
it for kills (since they're already dead), but what about the ps
listing? It don't think we need to check it because in the project
description, zombies are defined as " Any process that is dead, but
still has a reference count greater than 0 is called a zombie. That is,
it is dead, but cannot yet be reaped by the reaper. " Therefore, no
zombie processes would ever be in s_graveyardQueue since Reap_Thread
(which is the only place processes are being added to it) only gets
called when refCount == 0 (see Detach_Thread).
s_reaperWaitQueue - it seems like its only purpose is to hold the single
kernel Reaper thread and then have Wake_Up called on it from time to
time to let the Reaper know that there is work to do. Therefore we'll
never have to check it for kills (since the Reaper thread is a kernel
thread that can't be killed). We don't explicitly have to check it for
ps listings (since, as above, if the thread is not in R or Z state, it
must be in S state), but if you are checking queues to determine the S
state, then this one must be included (otherwise pid 3, the Reaper
thread, won't have the proper state). Is all of this correct?
Zombies - as was pointed out before, zombies are not on any queue.
They're dead, so obviously not on the runQueue or any of the I/O queues.
They're also not on the graveyardQueue or the reaperWaitQueue (see
above). However, they are still on the s_allThreadList. A good way to
check for them is to take the description's definition of zombies (see
above) quite literally (is it dead? is its refCount > 0?).
Dr. Hicks and the TA's, please correct any inaccuracies in the above
information.
Daniel