The obvious difference is that os.spawnle
is used to start another process running a different program, whereas a thread would be executing code that's part of the same program. In fact, if your background process is some other program that already exists, then os.spawnle
(or some other means of creating a separate process) is your only option; two threads in a program have to be running the same program.
If you wondering whether you should structure your own code to be run as separate processes or as separate threads, then take a look at some of the process v. thread questions like this one to decide which better fits what you're trying to do. In particular, consider what resources the processes/threads will need to share, what they will communicate with each other, and how robust each needs to be -- a thread that crashes will bring the rest of the process down with it, for example.