<div>I&#39;ve been trying to figure this stuff out for a couple of years, and this is as far as I&#39;ve got in my musings.</div><div><br></div>Python has lots of functional programming features, but even in functional languages, &quot;side effects&quot; impacting state outside the function&#39;s internal scope require &quot;heroic&quot; efforts (like locking or message passing/serialization) to avoid breaking parallel execution or concurrency/responsiveness.<div>
<br></div><div>The declarative programming style makes it trivial to graph which code cares about which objects in memory. That forces the programmer to solve the problems a priori, which as it turns out, are the real issue with effectively getting rid of the GIL in Python, thus ending this debate.</div>
<div><br></div><div><font face="arial, sans-serif"><span style="line-height:18px"><a href="http://dabeaz.blogspot.com/2011/08/inside-look-at-gil-removal-patch-of.html">http://dabeaz.blogspot.com/2011/08/inside-look-at-gil-removal-patch-of.html</a></span><br>
</font><br>What we need is smarter memory management, but I think it needs to be somewhere between the Spartan approach of functional languages and the relatively cushy GC&#39;ed object-oriented languages.</div><div><br></div>
<div>I wonder if there isn&#39;t a perspective available from the AST or something that would allow cherry-picking sections of logic which can be decomposed more or less like what you&#39;d end up with from strict functional code, and possibly executing them in another context (interpreter context, thread, greenlet?) which would allow releasing the GIL. Or possibly the opposite, and cherry pick sections of code which must acquire the GIL?<br>
<br>The end result is that when you program in Python, but you&#39;re careful to code in a style that allows embarrassingly parallel execution, you get some reprieve from the GIL. There has to be some way to guarantee that no code outside your intended parallel context can ever refer to anything inside, and then side-effects when you can&#39;t avoid them, will block waiting for the GIL. One practical example would be that using map() and reduce() in Python would automatically parallelize execution across multiple CPUs.</div>
<div><br><div class="gmail_quote">On Sat, Feb 18, 2012 at 11:02 AM, Andrey Popp <span dir="ltr">&lt;<a href="mailto:8mayday@gmail.com">8mayday@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 18.02.2012, at 17:19, Mike Meyer &lt;<a href="mailto:mwm@mired.org">mwm@mired.org</a>&gt; wrote:<br>
<br>
&gt; If you haven&#39;t seen it, this is probably worth a gander:<br>
&gt; <a href="http://yow.eventer.com/events/1004/talks/1055" target="_blank">http://yow.eventer.com/events/1004/talks/1055</a><br>
&gt;<br>
&gt; It&#39;s a research scientist discussing his plans for concurrency in<br>
&gt; Haskell. I think his goals - and ideas - are pretty solid.<br>
<br>
</div>These thing are already implemented in Haskell and more or less practically usable.<br>
<div class="HOEnZb"><div class="h5"><br>
&gt; However,<br>
&gt; since he&#39;s doing research, he can afford to use an obscure language<br>
&gt; that makes his life easier. Getting this stuff working in a practical<br>
&gt; language like Python will be a bit more difficult.<br>
&gt;<br>
&gt;    &lt;mike<br>
&gt; --<br>
&gt; Mike Meyer &lt;<a href="mailto:mwm@mired.org">mwm@mired.org</a>&gt;        <a href="http://www.mired.org/" target="_blank">http://www.mired.org/</a><br>
&gt; Independent Software developer/SCM consultant, email for more information.<br>
&gt;<br>
&gt; O&lt; ascii ribbon campaign - stop html mail - <a href="http://www.asciiribbon.org" target="_blank">www.asciiribbon.org</a><br>
&gt; _______________________________________________<br>
&gt; concurrency-sig mailing list<br>
&gt; <a href="mailto:concurrency-sig@python.org">concurrency-sig@python.org</a><br>
&gt; <a href="http://mail.python.org/mailman/listinfo/concurrency-sig" target="_blank">http://mail.python.org/mailman/listinfo/concurrency-sig</a><br>
_______________________________________________<br>
concurrency-sig mailing list<br>
<a href="mailto:concurrency-sig@python.org">concurrency-sig@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/concurrency-sig" target="_blank">http://mail.python.org/mailman/listinfo/concurrency-sig</a><br>
</div></div></blockquote></div><br></div>