Python threading/multiprocessing issue.

Chris Angelico rosuav at gmail.com
Fri Jul 15 19:34:40 EDT 2011


2011/7/16 Lee Harr <missive at hotmail.com>:
> I am not a multiprocessing expert, but I think the problem you
> are having is that Process is running your code in a separate
> process, so there is no way you could see those object changes
> in your main line code.
>
> In other words, Process is not an exact replacement for Thread.
>

That's correct; inter-process communication is the realm of sockets
(network or Unix), pipes, signals, etc - but inter-thread
communication is a matter of making sure you don't tread on each
other's toes. In CPython, the latter is guaranteed by the GIL; the
specific advantage of multiprocessing over threading is that each
process has a separate GIL, and that's because all variables are
separate.

ChrisA



More information about the Python-list mailing list