I am new to python threading. I am trying to understand what happens when os.system() is called from a python thread. I understand that threads do share file descriptors, heap, code and global variables. I also read that os.system(cmd) creates a new subshell and there it executes the cmd provided.
My question is, when python threads call os.system(cmd) and the cmd executes "./test.exe input_file.dat", does the process for ./test.exe share anything (i.e. input files, address space, heap, etc.) with the python threads? In other words, does os.system(cmd) create a new process which has no relation with the caller process or thread?
Below, I provided the python code I wrote.
#!/usr/bin/python
import threading
import os
semaphore = threading.Semaphore(3)
def run_command(cmd):
with semaphore:
os.system(cmd)
for i in range(3):
threading.Thread(target=run_command, args=("./test.exe input_file.dat", )).start()