r/programming • • Feb 24 '13

Ruby 2.0.0

http://www.ruby-lang.org/en/news/2013/02/24/ruby-2-0-0-p0-is-released/
600 Upvotes

193 comments sorted by

View all comments

Show parent comments

6

u/pnwf Feb 24 '13

This is huge. For so long doing anything that requires concurrency in Ruby was a tradeoff between using threads and suffering through weird hard-to-reproduce threading bugs and taking the performance hit of the GIL/GVL, or fork()ing and taking the memory hit when all your child processes' GCs force them to each have their own copy of memory that should be shared since it is never modified.

1

u/Amadan Feb 24 '13

I'm not very good at low-level, so... Does this mean GIL is gone? Or at least soon-to-be-gone?

6

u/cartola Feb 24 '13

The GIL isn't gone and there isn't an end in sight. It has been "renamed" to GVL (Global VM Lock), but as Aaron Patterson said in one talk it's the same thing. VMs are hard and Matz prefers Ruby's VM to be simple and easy to understand to being extremely fast and optimized at the cost of maintenance.

Taking out a GIL isn't easy and the CPython guys apparently did it some ancient time ago and experienced performance degradation (or it wasn't as great as once thought). The best VM without one is the JVM, so JRuby is the best bet. It'll probably never leave MRI.

1

u/drbrain Feb 25 '13

One of the improvements Nari wishes to make is to have the GC be GVL-free.

It's gradually being pushed out of CRuby, but it's not easy to do so and keep performance. I remember FreeBSD pushing it's global lock out of the kernel, it took quite a long time to do all the tuning to get their speed back.

That will leave the VM and C extensions under the GVL. For C extensions it's fairly easy to release the GVL when they are doing work.

PS: Ruby has never had anything called a "GIL". The lock was added around the same time the ruby switched to a VM, so it has always been a global VM lock.