
March 7, 2008
10:30 a.m.
Mike Pelletier wrote:
On Fri, Mar 7, 2008 at 8:36 AM, Phil Mayers <p.mayers@imperial.ac.uk> wrote:
If you fork a python interpreter, you should very quickly replace the process with exec.
Does fork+exec have any advantages over spawn?
If you mean "os.spawnXX" I think that, under Unix, those *are* fork & exec, so no - they're identical. I don't think there's a native unix syscall "spawn". Seems I recall there is something in the MS VC runtime named similar. Anyway - if we're talking about Twisted, you want to use the Twisted support - reactor.spawnProcess and a subclass of t.i.p.ProcessProtocol to talk to the child worker. reactor.spawnProcess does the right thing(tm)