I have an executable under linux. I have an 8 core processor. I want to run 8 different instances of the same executable with different arguments.
I tried
os.system("process_name args")
It does not return until the process is finished.
I want to start 8 different processes from python
If someone could help me please.
Thanks a lot
I think you're looking for the Popen
objects from the subprocess
module.
Note that if you want to redirect I/O to and from the process, this scenario becomes complex because the recommended way to to this is to call .communicate()
which you won't be able to use if you want to manage multiple processes simultaneously. On UNIX-like systems, pipes can be passed to the select()
system call so you can use the select
module to perform I/O. This won't work on Windows because the select()
implementation only accepts socket handles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With