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

Armin Steinhoff a-steinhoff at web.de
Sun Aug 4 15:44:47 EDT 2002


loewis at informatik.hu-berlin.de (Martin v. Löwis wrote in message news:<j4ado2rbwn.fsf at aramis.informatik.hu-berlin.de>...
> 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.

It depends on the OS ... with QNX it's simple: after starting pyhon
you have just to type in the command 'slay -P 10r python' :)
(10r -> r stands for RR)

Well ... I think there is in general NOT a BUG in Python !!

The context switching could not be optimal in some very special cases.
(FIFO, RR scheduling ... but in such cases could sched_yield() help)

Armin
 

> 
> Regards,
> Martin



More information about the Python-list mailing list