global interpreter lock not working as it should

brueckd at tbye.com brueckd at tbye.com
Thu Aug 1 16:46:14 CEST 2002


On 1 Aug 2002, Armin Steinhoff wrote:

> > However, this problem is solved by placing a explicit sched_yield between the 
> > calls to release the lock and to acquire the lock again in the interpreter 
> > loop. Then, switching works perfectly. 
> > 
> > What is the problem here? 
> 
> The 'problem' is that Python threads are not fully comparable with
> system level threads. Python threads are managed (scheduled) at
> _interpreter level_!!
> 
> The important difference is that Python threads can't use e.g.
> blocking I/O calls ... a blocking I/O call used in a Python thread
> will block the whole interprete!!.

No, no, no. 

I have no idea where all this confusion is coming from lately, but on a
single CPU system, threading in Python works pretty much the same as
thread libraries in other languages, e.g. C. Give it a try!

> Real threading is only possible if each Python thread whould be
> handled by an own instance of the interpreter which is running in its
> own system thread.

I'm sorry, but this is simply not true.

-Dave





More information about the Python-list mailing list