Message136953
In the common case, I don't think that the os.waitpid(0, 0) is the hot spot, but rather this:
for child in self.active_children:
os.waitpid(child, os.WNOHANG)
It's called every time, and it's O(number of active children).
os.waitpid(0, 0) is only called when max_children (40) is reached. Also, I'm not sure why it's called without WNOHANG, because that means that we will block until active_children falls below max_children. That's an arbitrary limit, especially since it's not documented.
I've written a first draft patch using process group, that removes active_children and max_children.
The only slightly tricky part is the call to setpgid from the child and from the parent, to avoid a race where the child could try to join a stale PGID.
Note that I assume that setpgid is available on every Unix, since according to http://pubs.opengroup.org/onlinepubs/007908799/xsh/setpgid.html , it's "Derived from the POSIX.1-1988 standard".
Also, according to buildbots' configure logs, it's available everywhere. |
|
Date |
User |
Action |
Args |
2011-05-26 12:46:23 | neologix | set | recipients:
+ neologix, orsenthil, pitrou |
2011-05-26 12:46:23 | neologix | set | messageid: <1306413983.8.0.405139663003.issue12184@psf.upfronthosting.co.za> |
2011-05-26 12:46:22 | neologix | link | issue12184 messages |
2011-05-26 12:46:22 | neologix | create | |
|