The reliability of python threads

Klaas mike.klaas at gmail.com
Wed Jan 24 20:07:49 EST 2007


On Jan 24, 4:11 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> "Klaas" <mike.kl... at gmail.com> writes:
> > POSIX issues aside, Python's threading model should be less susceptible
> > to memory-barrier problems that are possible in other languages (this
> > is due to the GIL).

> But the GIL is not part of Python's threading model; it's just a
> particular implementation artifact.  Programs that rely on it are
> asking for trouble.

CPython is more that "a particular implementation" of python, and the
GIL is more than an "artifact".  It is a central tenet of threaded
python programming.

I don't advocate relying on the GIL to manage shared data when
threading, but 1) it is useful for the reasons I mention 2) the OP's
question was almost certainly about an application written for  and run
on CPython.

> > Double-checked locking, frinstance, is safe in python even though it
> > isn't in java.

> What's that?

google.com

-Mike




More information about the Python-list mailing list