Python threading/multiprocessing issue.

Chris Angelico rosuav at gmail.com
Sat Jul 16 01:19:21 EDT 2011


On Sat, Jul 16, 2011 at 3:15 PM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
> And (so far as I understand it) each process can claim its own CPU
> core, whereas threads share the active core.

Threads can be put onto separate cores too, and can have their
affinities set. But because of the GIL, actual CPython code can't run
on two cores at once. You might be able to have two Python threads
running at once if they're calling into C modules most of the time,
but it's much safer to either go multiprocessing or to use I/O bound
threads (eg socket handlers).

ChrisA



More information about the Python-list mailing list