Lock-Free Data Structures and Turning off the GIL
Andrew Francis <andrewfr_ice-/[email protected]> Mon, 9 Jun 2014 14:15:58 -0700 (PDT)
| Newsgroups | gmane.comp.python.stackless |
|---|---|
| Message-ID | <[email protected]> |
--===============1297835280434537252== Content-Type: multipart/alternative; boundary="1936327721-1736041389-1402348558=:23231" --1936327721-1736041389-1402348558=:23231 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi Folks:=0A=0AI recently started looking at Mozilla's new language Rust an= d its channel implementation. A little challenging since Rust is written in= Rust. Unlike Go, I think Rust's model is very very different from Stackles= s Python. Still something that piqued my interest was that Rust's implement= ation uses lock free queues.=A0=0A=0AIt would be interesting to benchmark R= ust and Go's channel performance ....=0A=0ALast year, I wanted to experimen= t with lock free queues with PyPy using parts of its STM API. This way I wo= uldn't have to worry about a GIL getting in the way.=0A=0AI thought perhaps= it would be easier to experiment with C Based Stackless Python instead.=0A= =0AI 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 hoo= d?=0A=0ACheers,=0AAndrew --1936327721-1736041389-1402348558=:23231 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable <html><body><div style=3D"color:#000; background-color:#fff; font-family:He= lveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;fo= nt-size:12pt"><div>Hi Folks:</div><div><br></div><div style=3D"color: rgb(0= , 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Hel= vetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-= color: transparent;">I recently started looking at Mozilla's new language R= ust and its channel implementation. A little challenging since Rust is writ= ten in Rust. Unlike Go, I think Rust's model is very very different from St= ackless Python. Still something that piqued my interest was that Rust's imp= lementation uses lock free queues. </div><div style=3D"color: rgb(0, 0= , 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvet= ica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-col= or: transparent;"><br></div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Luc= ida Grande', sans-serif; font-style: normal; background-color: transparent;= ">It would be interesting to benchmark Rust and Go's channel performance ..= ..</div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family: He= lveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-seri= f; font-style: normal; background-color: transparent;"><br></div><div style= =3D"color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helv= etica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: nor= mal; background-color: transparent;">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.</div><div style=3D"color: rg= b(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', = Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color: transparent;"><br></div><div style=3D"color: rgb(0, 0, 0= ); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica= , Arial, 'Lucida Grande', sans-serif; font-style: normal; background-color:= transparent;">I thought perhaps it would be easier to experiment with C Ba= sed Stackless Python instead.</div><div style=3D"color: rgb(0, 0, 0); font-= size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial,= 'Lucida Grande', sans-serif; font-style: normal; background-color: transpa= rent;"><br></div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-f= amily: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', = sans-serif; font-style: normal; background-color: transparent;">I have a si= lly question: "what happens if one turns off the GIL"? If one has two threa= ds that don't explicitly share state, will a Python programme still functio= n properly? Or are there other things happening under the hood?</div><div style=3D"color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,= 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-styl= e: normal; background-color: transparent;"><br></div><div style=3D"color: r= gb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue',= Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal; backgro= und-color: transparent;">Cheers,</div><div style=3D"color: rgb(0, 0, 0); fo= nt-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Ari= al, 'Lucida Grande', sans-serif; font-style: normal; background-color: tran= sparent;">Andrew</div></div></body></html> --1936327721-1736041389-1402348558=:23231-- --===============1297835280434537252== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Stackless mailing list [email protected] http://www.stackless.com/mailman/listinfo/stackless --===============1297835280434537252==--