Python threading (was: Re: global interpreter lock not working as it should)

Armin Steinhoff a-steinhoff at web.de
Sun Aug 4 12:31:15 CEST 2002


aahz at pythoncraft.com (Aahz) wrote in message news:<aihom5$lp2$1 at panix1.panix.com>...
> In article <ddc19db7.0208031200.5823a2e at posting.google.com>,
> Armin Steinhoff <a-steinhoff at web.de> wrote:
> >
> >IMHO ... there is nothing like a 'thread-scheduler' in the python
> >code.
> 
> Correct.
> 
> >All python threads are scheduled by the OS ... that means there is no
> >code in the python program which can _force_ periodically a thread to
> >leave this critical section ( e.g. in the middle of the execution of
> >the 10 byte codes).
> 
> ...except for calling an extension that releases the GIL.  As I've said
> before, Python threads are in effect a weird combination of pre-emptive
> and cooperative scheduling.  While it's an extremely complex model in
> some respects,

Well ... from the documentation point of view are some important
concepts hard to understand.

>it does overall simplify much implementation, both in the
> Python core and from the user side.

Exactly .... as a result of this discussion I have to update my
message passing extension module in order to make it 'GIL safe' :) It
includes several blocking IPC calls ...

Armin



More information about the Python-list mailing list