[Python-ideas] Thread IPC idea: Quipe? Sockqueue? (Re: Python and Concurrency)

Jim Jewett jimjjewett at gmail.com
Fri Mar 30 21:49:01 CEST 2007


On 3/29/07, Ron Adam <rrr at ronadam.com> wrote:
> Jim Jewett wrote:
> > What we really need is a Task object that treats shared memory
> > (perhaps with a small list of specified exceptions) as immutable.

> * A 'better' task object for easily creating tasks.
>       + We have a threading object now. (Needs improving.)

But the task isn't in any way restricted.  Brett's security sandbox
might be a useful starting point, if it is fast enough.  Otherwise,
we'll probably need to stick with microthreading to get things small
enough to contain.

> * Shared memory -
>       + Prevent names from being rebound
>       + Prevent objects from being altered

I had thought of the names as being part of a shared dictionary.  (Of
course, immutable dictionaries aren't really available out-of-the-box
now, and I'm not sure I would trust the supposed immutability of
anything that wasn't proxied.)

>      frozen: object can't be altered while frozen
>      locked: name can't be rebound to another object


>      3. Pass mutable "deep" copies back and forth.
>            ? Works now. (but not for all objects?)

Well, anything that can be deep-copied -- unless you also want the
mutations to be collected back into a single location.

>      4. Pass frozen mutable objects.
>            - Needs freezable/unfreezable mutable objects.
>              (Not the same as making an immutable copy.)

And there is where it starts to fall apart.  Though if you look at the
pypy dict and interpreter optimizations, they have started to deal
with it through versioning types.

http://codespeak.net/pypy/dist/pypy/doc/interpreter-optimizations.html#multi-dicts
http://codespeak.net/pypy/dist/pypy/doc/interpreter-optimizations.html#id23

-jJ



More information about the Python-ideas mailing list