]> git.evergreen-ils.org Git - OpenSRF.git/commit
Instead of keeping all child processes in a single list, keep them in two
authorscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 18 Jan 2010 03:00:13 +0000 (03:00 +0000)
committerscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 18 Jan 2010 03:00:13 +0000 (03:00 +0000)
commitae29852892227424c683ca56d84fd60075e6afff
tree36f2d92176450889166333dc299d7c0df95db557
parent64cba6b48a1f865d4615f7e17e7a729f12bc4fc2
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
src/libopensrf/osrf_prefork.c