global interpreter lock not working as it should

Martin v. Loewis martin at v.loewis.de
Sat Aug 3 06:09:33 EDT 2002


a-steinhoff at web.de (Armin Steinhoff) writes:

> There are well known different scheduling strategies:
> 
> FIFO, Round Robin, adadptive scheduling, sporadic scheduling (RMA)
> 
> If you run the Python interpreter with FIFO or RR scheduling ... 

You won't: Python will run in the SCHED_OTHER posix scheduling class.
What this means depends highly on the operating system, but usually is
some kind of adaptive or sporadic scheduling.

> That means, if a Python thread with a higher priority acquieres the
> GIL, the running thread with the lower priority will inherit the
> priority of the other thread (if priority inheritance is supported, if
> not you will have the case of priority inversion ...) in order to
> complete its task as soon as possible.
> In such a case we will see a context switch between the realease_lock
> and the acquire_lock calls.

And indeed, that is what is supposed to happen.

Regards,
Martin



More information about the Python-list mailing list