Yes, all manner of bad things will happen.
The entire run-time machinery of CPython is protected by the GIL.
The most obvious one is the reference count of objects.  Even if "not sharing 
state" you are still sharing common objects such as modules, etc.
Then there is all sorts of internal caching of objects.  Import mechanism.
Almost every aspect of CPython would need to be touched (I guess) to make it 
thread-safe, or re-entrant.

K

From: stackless-boun...@stackless.com [mailto:stackless-boun...@stackless.com] 
On Behalf Of Andrew Francis
Sent: 9. júní 2014 21:16
To: The Stackless Python Mailing List
Cc: Christian Tismer
Subject: [Stackless] Lock-Free Data Structures and Turning off the GIL

Hi Folks:

I recently started looking at Mozilla's new language Rust and its channel 
implementation. A little challenging since Rust is written in Rust. Unlike Go, 
I think Rust's model is very very different from Stackless Python. Still 
something that piqued my interest was that Rust's implementation uses lock free 
queues.

It would be interesting to benchmark Rust and Go's channel performance ....

Last year, I wanted to experiment with lock free queues with PyPy using parts 
of its STM API. This way I wouldn't have to worry about a GIL getting in the 
way.

I thought perhaps it would be easier to experiment with C Based Stackless 
Python instead.

I have a silly question: "what happens if one turns off the GIL"? If one has 
two threads that don't explicitly share state, will a Python programme still 
function properly? Or are there other things happening under the hood?

Cheers,
Andrew
_______________________________________________
Stackless mailing list
Stackless@stackless.com
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to