[Stackless] Multi-CPU Actor Based Python

Larry Dickson ldickson at cuttedge.com
Wed Nov 19 16:19:04 CET 2008


The key word ought to be "stackless" as in "Stackless Python." The
Transputer and occam people showed long ago that multiprocessing (which is
what you are really talking about here) as well as multitasking become
really easy (i.e. overhead of a dozen cycles or so) if you get rid of
implicitly shared resources like stack. You can still do stacky things that
just take a moment (e.g. "soft interrupts") but very frequently you come up
for air which means your stack depth goes to 0 and then you can do all the
comms and context switching you want.

If Stackless lives up to its name, it should be very easy to get multiple
VMs talking to each other. You just treat their comms as external comms and
extend the local tasklet response to socket-like things as we were talking
about in the earlier thread. Then the VMs themselves, obviously, must not
share resources, or if they do, there must be very strict design control at
that point.

Larry Dickson

On 11/19/08, Timothy Baldridge <tbaldridge at gmail.com> wrote:
>
> What I'm more looking to reduce, is the overhead of transferring data
> from one Python VM to another. In current implementations transferring
> data from one VM to another requires pickling data (and that requires
> traversing the entire object being transmitted, pickling each part
> along the way), transmitting it across the wire, then unplickling it
> at the other end. So where talking thousands of cycles.
>
> In the method I'm proposing, you could have multiple "VMs" in the same
> process, with a unified GC, these VMs would would share nothing. If
> all messages are immutable, then all that is required is to copy a
> pointer from one VM to the other and increment the GC ref count on the
> message. That's what, 100-200 cycles or so (yes I did just pull that
> out of the air).
>
> My core idea here is that multitasking in modern languages isn't as
> pervasive because of the overhead/risks involved. In C you have shared
> memory issues. In Erlang, well, many people can't stand the Erlang
> syntax. And in Python you can't have to pass messages via
> pipes/channels/sockets.
>
> So does anyone else see this being possible, or am I off my rocker?
>
> Timothy
>
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20081119/d8e7df67/attachment.htm>


More information about the Stackless mailing list