I'm writing a python 3 program that will start another python program to process files. I need the main program to keep an arbitrary number of processes running at any time. I'll read the arbitrary number from a file each time one of the processes finishes to see if the another process should be spawned.
What is the best way to spawn the processes? I need to know when the process finishes so I can spawn another, but that is all. And, I would really like the spawned program to execute as a completely separate process. The processes are long running and utilize a lot of resources. I don't need to know about the output or exit status of the program, just that it exited.
I've considered using mutex files created by the processes, but I've had dodgy results with those.
Any suggestions?