Process
- 1 multiprocessing.context.Process class The Python class multiprocessing.Process represents a running process. Using this constructor of this class Process(), a process can be created and started. Process class has several attributes and methods to manage a created process. 2 Feb 2019
- 2 process.is_alive() method The process.is_alive() method of Python returns whether a process corresponding to the Process instance is alive or not. The Python example prints the return value of is_alive() method while a process is running as well as when it has exited. 3 Feb 2019
- 3 Process.join Process.join() method, makes the calling process wait for the process instance on which it was called to complete. In the Python example the main process creates three processes and wait for all of them to complete using the join() method. 3 Feb 2019
- 4 process.kill method The process.kill() method of Python kills the process associated with the process instance. It used SIGKILL to terminate the process. 6 Feb 2019
- 5 Process class constructor - Python multiprocessing A process instance can be created by calling the Process class constructor of Python multiprocessing package. Calling start method on the returned process instance makes the new process running inside the operating system 2 Feb 2019
- 6 run method To start a new process, the run() method of the class multiprocessing.context.Process class is overridden and start() is called on the derived class instance. Alternatively, when Process is directly instantiated it calls the target argument passed through the constructor during start() call. The python examples demonstrate both the methods. 2 Feb 2019
- 7 process.start() method The process.start() method in Python executes the process using the contents of the run() function or the callable object passed to the target parameter of the Process constructor. Python examples of both the cases are provided along with output. 3 Feb 2019
- 8 process.terminate() method The Python method process.terminate() uses SIGTERM to terminate a process. The child processes of the terminated processes are not terminated. The Python example terminates the child process and prints the output. 6 Feb 2019