
March 7, 2008
8:36 a.m.
Andreas Kostyrka wrote:
Actually, on a modern system like Linux, if you fork, the process share memory as long it's not written too (Copy-on-Write).
This means, that if you'd fork off your process pool from your application, forking should have minimal impact. Even writing it as a standalone process means memory usage of one Python interpreter, plus minimal usage in the forked processes.
If you fork a python interpreter, you should very quickly replace the process with exec. The reason is that if you de-reference something, Python might deallocate it in a way that causes the parent process to lose it too e.g. send a shut down message on SQL connections.