[Tutor] could someone please explain multiprocessing

Mats Wichmann mats at wichmann.us
Fri Jul 3 15:47:19 EDT 2020


On 7/2/20 5:20 PM, nathan tech wrote:
> Hi tutor List,
> 
> 
> I hope everyone is keeping safe and doing well.
> 
> I was wondering if someone was able to explain the multiprocessing
> module to me.
> 
> I'm trying to get it to where my program would be able to do something
> like:
> 
> Hi parent, are you running?
> 
> Yes I am.
> 
> Great, here is a file for you.
> 
> Thanks child, you can close now and not launch a second instance.
> 
> okay, goodnight!
> 
> 
> So far the way I've done this is through the socket module by having the
> first program listen on localhost, but this on some systems raises a
> windows security error. This obviously makes it rather suspicious!


Multiprocessing is easy, until it isn't.  Which usually happens fairly fast.

"easy": kick off a new process to do a bit of self-contained work.
"harder": send short messages between processes
"also harder": coordinate between processes (locks, etc.)
"still harder": send data between processes

the documentation for the Python multiprocess module talks about all of
these and more.



More information about the Tutor mailing list