How to run a process in the background
Running a process in background is a typical mode of execution of laborious processes that do not require your presence or intervention, and this course may be concurrent to the execution of other programs. The Python multiprocessing module allows us, through the daemonic option, to run background processes.
How to do it...
To run a background process, simply follow the given code:
import multiprocessing import time def foo(): name = multiprocessing.current_process().name print ("Starting %s \n" %name) time.sleep(3) print ("Exiting %s \n" %name) if __name__ == '__main__': background_process = multiprocessing.Process\ (name='background_process',\ target=foo) background_process.daemon = True NO_background_process = multiprocessing.Process\ (name='NO_background_process',\ target=foo) NO_background_process.daemon...