So I guess the next question would be, how does the GIL actually work
in PyPy. Let's say you have two threads running jitted code. Does a
jitted code loop run one, release the GIL, acquire, run again, etc? In
CPython the GIL is released every X number of bytecodes, but jitted
code doesn't have bytecodes, so what is the level of cooperation
there? Is the jitted code littered with cooperative "release-lock"
instructions?

Thanks,

Timothy

On Fri, Jan 13, 2012 at 11:35 AM, Armin Rigo <[email protected]> wrote:
> Hi Timothy,
>
> On Fri, Jan 13, 2012 at 16:37, Timothy Baldridge <[email protected]> wrote:
>> But in CPython we
>> can do this ugly little hack for getting "free" locks where you
>> basically set the GIL "remaining" bytecodes count to 32 billion,
>> execute your code, then return it to the original value.
>
> Bah!  That's a hack indeed.
>
> I think the cleanest solution would be to write the compare-and-swap
> operation as C code in CPython, and as RPython code in PyPy.
>
> Otherwise, I'm unsure about getting compare-and-swap, but you can
> definitely do some atomic operations using lists or dicts.
>
>
> A bientôt,
>
> Armin.



-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to