Python threading (was: Re: global interpreter lock not working as it should)
Martin v. Loewis
martin at v.loewis.de
Tue Aug 6 21:38:52 CEST 2002
anton wilson <anton.wilson at camotion.com> writes:
> > > The timer tick does happen 100x per second and since python gives up
> > > the lock every 10 us or so, it's really not a huge coincidence for
> > > an overlap. I just don't really like the reliance on this
> > > coincidence.
> > Accept it. It is meant to work this way.
> I understand that, but still . . . you have to agree that the ratio here is
> pretty horrible for certain systems even if it was supposed to be
> cross-platform. It works as it should, but for this particular OS, it could
> be helped along. There's nothing wrong with being more efficient if you can
> be and it won't hurt any design goals.
I'm all in favour of efficiency. However, adding more thread switches
is likely to hurt efficiency, instead of increasing it. Notice that
the total amount of work to do is fixed, and it consumes a certain
amount of time when done strictly sequentially. Adding thread switches
extends completion time, and thus decreases performance.
More information about the Python-list