News for hackers. Stuff that matters.
Re:Let's Remove the Global Interpreter Lock by vasilakisfil on Monday August 14, 2017 @10:20AM (#15008717)
Just curious: if they solve it in Python, would it be possible to solve it in Ruby too ?
Re:Let's Remove the Global Interpreter Lock by chrisseaton on Monday August 14, 2017 @11:11AM (#15009165)
JRuby, Rubinius and TruffleRuby are all existing implementations of Ruby without a GIL.
Re:Let's Remove the Global Interpreter Lock by fny on Monday August 14, 2017 @10:38AM (#15008856)
This is in the cards for Ruby 3. The plan is to migrate away from a global interpreter lock to "guilds" which are akin to execution contexts. These guilds also have a locking mechanism that allows for parallelism which they call the "global guild lock."

You can learn more about concurrency in Ruby 3 at this wonderful blog post: http://olivierlacan.com/posts/concurrency-in-ruby-3-with-gui...

Re:Let's Remove the Global Interpreter Lock by pjmlp on Monday August 14, 2017 @10:57AM (#15009034)
It is already solved for Ruby when you use JRuby.
Re:Let's Remove the Global Interpreter Lock by taf2 on Monday August 14, 2017 @10:22AM (#15008731)
If I understand correctly the issue in Ruby is the existing C extensions that have been written to assume the lock exists...
Re:Let's Remove the Global Interpreter Lock by myusernameisok on Monday August 14, 2017 @10:25AM (#15008748)
It's the same issue with Python. AFAIK there are a number of Python libraries that are not thread-safe, and the GIL prevents them from being an issue.
Re:Let's Remove the Global Interpreter Lock by aidenn0 on Monday August 14, 2017 @11:59AM (#15009619)
I thought the GIL was not held during execution of foreign code in python (at least that was one point given for why the GIL wasn't a big deal in practice).
Re:Let's Remove the Global Interpreter Lock by dom0 on Monday August 14, 2017 @12:11PM (#15009755)
No, it must be explicitly released. The GIL must be held to invoke almost all Python runtimes (main exceptions: acquiring the GIL, low-level allocator).
Re:Let's Remove the Global Interpreter Lock by shwouchk on Monday August 14, 2017 @11:27AM (#15009345)
GIL does not help thread safety in application code (and external libraries), just in the VM.
Re:Let's Remove the Global Interpreter Lock by myusernameisok on Monday August 14, 2017 @01:33PM (#15010579)
I'm fairly certain you're incorrect. With the GIL you don't have to lock shared memory because the assumption is that only one thread will be running at a time. For example shared data structures won't be changed while being being read/written to by multiple threads, because only one thread is actually running.
Re:Let's Remove the Global Interpreter Lock by shwouchk on Tuesday August 15, 2017 @06:32PM (#15023347)
You are entirely mistaken, unless all you care about are the basic built in dict/list and some of the other built in data structures AND each thread only stores OR reads data (i.e. never reads and then stores it again), from a SINGLE container (you never care about consistent state between two different objects).

In my experience this is almost never the case. Moreover, this type of synchronization is trivial to accomplish with relatively little performance sacrifice.

What is much more complicated is getting more complex logic work correctly and performantly when you are interacting with multiple different data structures from something more than a saturated loop.

Re:Let's Remove the Global Interpreter Lock by dfox on Monday August 14, 2017 @05:10PM (#15012947)
For this environment (ie. you already have some kind of concurrent GC) it is probably significantly easier problem for Ruby than for Python.

Ruby does not have that much dynamism compated to "everything is dict of pointers to dicts" Python.