So I actually thought about similar approach. I was curious what do you think about approach to concurrency similar to what Apple did with C blocks and GCD. That is: enable threading but instead of the STM approach have fully explicit mutations within atomic blocks

2016-06-20 16:53 GMT+02:00 Armin Rigo <arigo@tunes.org>:
Hi Omer,

On 20 June 2016 at 08:51, Omer Katz <omer.drow@gmail.com> wrote:
> As for implementation, if we can trace the code running in the thread and
> ensure it's not mutating global state and that CPyExt is never used during
> the thread's course we can simply release the GIL when such a thread is run.

That's a very hand-wavy and vague description.  To start with, how do
you define exactly "not mutating global state"?  We are not allowed to
write to any of the objects that existed before we started the thread?
 It may be possible to have such an implementation, yes.  Actually,
that's probably easy: tweak the STM code to crash instead of doing
something more complicated when we write to an old object.

I'm not sure how useful that would be---or how useful PyParallel is on
CPython.  Maybe if you can point us to real usages of PyParallel it
would be a start.


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev



--
---------------------------
Michał Domański