Please go through the python code snippet below
import subprocess
child = subprocess.Popen("python ./myprog.py ", shell=True)
print "Hello"
Where myprog.py is simply :print "Hello,myprog"
The output I get is :
Hello
Hello,myprog
My question is whether the child process starts running parallel to the parent process or does the child waits for the parent process to finish off,as the above output suggests?
To my understanding, it is launched as another process in the same fashion as a Unix fork() or whatever the Windows equivalent is.
And then there’s this: http://docs.python.org/library/subprocess.html#subprocess.Popen.wait
Observe:
So, in essence, yes, it’s running in parallel.