Multiprocessing vs subprocess

Schachner, Joseph Joseph.Schachner at Teledyne.com
Tue Mar 12 12:24:25 EDT 2019


Re: " My understanding (so far) is that the tradeoff of using multiprocessing is that my manager script can not exit until all the work processes it starts finish. If one of the worker scripts locks up, this could be problematic. Is there a way to use multiprocessing where processes are launched independent of the parent (manager) process?"

I just want to point out that subprocess (which uses the operating system to start another processes, to run whatever you say - doesn't have to be Python running another script, can be an .exe)  does not have that restriction.  The subprocess call can be blocking (the caller waits), or not.   If not the caller can do whatever it wants including decide not to wait forever, and it can even exit.  

Of course, if one of the processes you launched is locked up that is a problem all by itself, even thought the manager can exit.

--- Joseph S.



More information about the Python-list mailing list