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

Martin v. Löwis loewis at informatik.hu-berlin.de
Sun Aug 4 09:28:24 EDT 2002


Jonathan Hogg <jonathan at onegoodidea.com> writes:

> God knows I'm no pthreads expert, but I know you can query the scheduling
> policy of the current thread. So if it's SCHED_RR, can one ask how much
> timeslice is left?

The thing is that the scheduling policy won't be SCHED_RR. First, this
is available to the superuser only. Furthermore, there is no Python
API to enter the SCHED_RR class (the relevant pthreads API is not
exposed).

So anybody wishing to do real-time threads has to modify the
interpreter, anyway (perhaps exposing additional functionality in the
process); they can then also solve the GIL problem in a way that is
appropriate for them. Most likely, they will find that assigning
different priorities to their threads will be sufficient. Getting
SCHED_RR to work will be tricky.

Regards,
Martin



More information about the Python-list mailing list