What is the difference between multiprocessing and subprocess?

前端 未结 3 488
闹比i
闹比i 2020-12-07 11:03

My work should use parallel techniques, and I a new user of python. So I wonder if you could share some material about the python multiprocessing and subp

3条回答
  •  無奈伤痛
    2020-12-07 11:29

    The subprocess module lets you run and control other programs. Anything you can start with the command line on the computer, can be run and controlled with this module. Use this to integrate external programs into your Python code.

    The multiprocessing module lets you divide tasks written in python over multiple processes to help improve performance. It provides an API very similar to the threading module; it provides methods to share data across the processes it creates, and makes the task of managing multiple processes to run Python code (much) easier. In other words, multiprocessing lets you take advantage of multiple processes to get your tasks done faster by executing code in parallel.

提交回复
热议问题