How to parallelly call OS.system() and wait them to finish their work? What's more, how to limit the max number of OS.system being parallelly called?
For example, to parallelly run Os.system('cd ~; ./run_tests ' + str(args_for_binary_program)) .
OS.system() is not the one that must be used.And if you have a better method, please let me know.
The CPU has 12 cores. And I am using Python3.8.
UPDATE:
Thanks to all of the people who replied to this post.
The similar posts mentioned in the comments do not clearly talk abot how to limit the max number of OS.system are parallely running.
For example, I need to run a specific binary program 100 times, but I must guarantee that never more than 5 programs are running at the same time. In other words, I need to know when each of the program finishes its work.