multiprocessing module name__main__ parent process process id aaaaaaaaaa note that the parent process and current process ids are printed out for the worker (functionwhile the main(method prints out only its own id this shows that the main application process id is the same as the worker process parentsid alternativelyit is possible to use the get_context(method to obtain context object context objects have the same api as the multiprocessing module and allow you to use multiple start methods in the same programfor examplectx multiprocessing get_context('spawn' ctx queue( ctx process(target fooargs ( ,) using pool creating processes is expensive in terms of computer resources it would therefore be useful to be able to reuse processes within an application the pool class provides such reusable processes the pool class represents pool of worker processes that can be used to perform set of concurrentparallel operations the pool provides methods which allow tasks to be offloaded to these worker processes the pool class provides constructor which takes number of argumentsclass multiprocessing pool pool(processesinitializerinitargsmaxtasksperchildcontextthese representprocesses is the number of worker processes to use if processes is none then the number returned by os cpu_count(is used initializer if initializer is not none then each worker process will call initializer(*initargswhen it starts maxtasksperchild is the number of tasks worker process can complete before it will exit and be replaced with fresh worker processto enable unused resources to be freed the default maxtasksperchild is nonewhich means worker processes will live as long as the pool