global interpreter lock not working as it should

Martin v. Loewis martin at v.loewis.de
Tue Jul 30 14:05:39 EDT 2002


anton wilson <anton.wilson at camotion.com> writes:

> What's the purpose of releasing an reaquiring the lock if no other threads 
> can run? 

Other threads *can* run - it is the operating system's choice whether
they *will* run.

> It's easy to say that one can't assume about the order of running on
> different platforms as a scapegoat, but the main problem is that the
> GIL is NOT implemented properly with pthreads.

Why do you say that? The implementation does work as intended.

> So nearly every system that uses pthreads will show this kind of
> queue behaviour. I have a feeling that there is a hidden race
> condition between when the thread wakes up the other thread and
> tries to reaquire the lock. It really should be fixed, or else
> what's the point of threads? Threads are for concurrency!

And concurrency you get (just modify my example to use infinite loops,
then tell me on what system you never ever see a thread switch).

Regards,
Martin



More information about the Python-list mailing list