Python multiprocessing continuously spawns pythonw.exe processes without doing any actual work

前端 未结 3 1805
广开言路
广开言路 2020-12-06 10:55

I don\'t understand why this simple code

# file: mp.py
from multiprocessing import Process
import sys

def func(x):
    print \'works \', x + 2
    sys.stdou         


        
3条回答
  •  孤街浪徒
    2020-12-06 11:19

    Funny, works on my Linux machine:

    $ python mp.py
    works  4
    done
    $
    

    Is the multiprocessing thing supposed to work on Windows? A lot of programs originated in the Unix world don't handle Windows so well, because Unix uses fork(2) to clone processes quite cheaply, but (it is my understanding) that Windows does not support fork(2) gracefully, if at all.

提交回复
热议问题