I recently saw the video of David Beazley's presentation on how poorly
the old GIL implementation handled certain cases and thought "I can fix
that!".  Unfortunately for me, someone else has beaten me to it, and
done a somewhat better job than I would've because I wasn't thinking of
doing anything about changing how ticks worked.

Antoine Pitrou wrote:
> - priority requests, which is an option for a thread requesting the
> GIL to be scheduled as soon as possible, and forcibly (rather than any
> other threads). This is meant to be used by GIL-releasing methods such
> as read() on files and sockets. The scheme, again, is very simple:
> when a priority request is done by a thread, the GIL is released as
> soon as possible by the thread holding it (including in the eval
> loop), and then the thread making the priority request is forcibly
> scheduled (by making all other GIL-awaiting threads wait in the
> meantime).

I notice that Guido vetoed this idea, but just in case it should come up
again, I have some thoughts that likely have already occurred to people,
but I didn't notice on the list.

I would be very careful with this.  The goal should be to avoid
re-implementing a scheduler of any kind in Python.  This comes
perilously close.  In my opinion this mechanism should _only_ be used
for signals.

I think implementing this for IO is fraught with peril and would almost
certainly require a scheduler to be implemented in Python in order to
work better than not having it at all while also avoiding pathological
cases.

Also, has anybody thought of starting work on making a set of Py* calls
that can be made without having the GIL acquired?

I don't suppose it will ever be ported back to Python 2.x?  It doesn't
look like the whole GIL concept has changed much between Python 2.x and
3.x so I expect back-porting it would be pretty easy.

This discussion is, of course, rather old.  But I browsed through all
the stuff people said in reply and I (perhaps foolishly) thought my two
cents might be helpful.


-- 
A word is nothing more or less than the series of historical
connotations given to it. That's HOW we derive meaning, and to claim
that there is an arbitrary meaning of words above and beyond the way
people use them is a blatant misunderstanding of the nature of language.
-- Anonymous blogger
-- Eric Hopper (hop...@omnifarious.org http://www.omnifarious.org/~hopper)--

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to