[Python-3000] Kill GIL?

Josiah Carlson jcarlson at uci.edu
Mon Sep 18 03:18:32 CEST 2006

"Giovanni Bajo" <rasky at develer.com> wrote:
> Josiah Carlson <jcarlson at uci.edu> wrote:
> > It would be substantially easier if there were a distributed RPC
> > mechanism that auto distributed to the "least-working" process in a
> > set
> > of potential working processes on a single machine.  [...]
> I'm not sure I follow you. Would you mind providing an example of a plausible
> API for this mechanism (aka how the code would look like, compared to the
> current Python threading classes)?

    import autorpc
    caller = autorpc.init_processes(autorpc.num_processors())

    import callables

    result = caller.fcn1(arg1, arg2, arg3)

The point is not to compare API/etc., with threading, but to compare it
with XMLRPC.  Because ultimately, what I would like to see, is a
mechanic similar to XMLRPC; call a method on an instance, that is
automatically executed perhaps in some other thread in some other
process, or maybe even in the same thread on the same process (depending
on load, etc.), and which returns the result in-place.

It's just much easier to handle (IMO).  The above example highlights an
example of single call/return.  What if you don't care about getting a
result back before continuing, or perhaps you have a bunch of things you
want to get done?

    q = Queue.Queue()

    caller.delayed(q.put).fcn1(arg1, arg2, arg3)
    r = q.get() #will be delayed until q gets something

What to do about exceptions happening in fcn1 remotely?  A fellow over
in the wxPython mailing list brought up the idea of exception objects;
perhaps not stackframes, etc., but perhaps an object with information
like exception type and traceback, used for both delayed and non-delayed

 - Josiah

More information about the Python-3000 mailing list