Instead of keeping all child processes in a single list, keep them in two
separate lists: one list of those which are currently servicing requests,
and another list of idle children. Move the children back and forth as
their status changes.
This change has three advantages:
1. When searching for an active child, there is a smaller list to search.
2. When doing a select() to identify children that have become available,
we can look for messages only from the active children, since the idle
ones won't write anything back to the parent. (Actually we could have
done this with a single list, but we didn't.)
3. Probably most important: since the idle list functions as a stack, we
assign the next request to the child that was most recently active, or was
most recently launched. That's the child that is most likely still to be
physically in memory. Formerly we assigned requests to children approximately
on a round-robin basis. As a result we assigned each new request to the
child that was most likely to be swapped out.
Also, in prefork_clear(): kill each child process individually. Sending a
SIGKILL to the entire process group kills the parent as well as the
children.
M src/libopensrf/osrf_prefork.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1892
9efc2488-bf62-4759-914b-
345cdb29e865