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

Aahz aahz at pythoncraft.com
Sat Aug 3 19:23:49 EDT 2002


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, it does overall simplify much implementation, both in the
Python core and from the user side.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/



More information about the Python-list mailing list