I am planning to make a long running background process with Python but I am still unsure whether to use os.spawnle or thread. I've only read about it therefore I have not much experience with either spawn or thread. Is there any rule of thumb when to use which?
Thanks heaps
Be sure that you take the Global Interpreter Lock into account. If the long running process is CPU intensive, you should probably make it an independent process. If on the other hand, it's going to spend a lot of time blocking, then the GIL isn't really that big of a deal and you should be fine to make it a thread.
Also, if you don't need something in particular that os.spawnle provides, consider using the multiprocessing package from the standard library. It provides an interface similar to that of the threading package and is altogether easier to use than mucking around with manually spawning and tracking processes.
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