thread. question

Tim Wintle tim.wintle at
Mon Feb 9 10:34:02 EST 2009

Thanks for both replies,

On Mon, 2009-02-09 at 15:59 +0100, Christian Heimes wrote:
> You shouldn't use the thread module directly. It's not meant to be used
> by a user. Please stick to the threading module. You won't notice a
> slowdown, trust me :)
I'm aware that thread is being renamed to _thread in python 3.0, but is
it being depricated or anything like that?

This is for an app that has been running for quite a long time and it's
now time for fairly heavy optimisations as load is increasing (Believe
me, I wouldn't have been looking at the C otherwise) - so I'll see if I
do notice any effect with threading.

> Yes, Python uses native threads, not green threads. However Python pure
> code can't utilize more than one CPU per process. On order to use
> multiple CPUs you have to use multiple processes or use C code that
> doesn't use any Python API. Google for "GIL" if you are interested in
> more information.

Thanks for the info - I'm very aware of the GIL, but had never looked at
the implementation before and for some reason thought that python's
threads were in userspace.

I'm already using a multiple-process architecture overall, but using
threads to avoid waiting when handling SQL and TCP.


More information about the Python-list mailing list