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.
It still has a GIL/GVL, but all those forking app servers will save a ton of RAM. I'd read suggest reading the articles from the Passenger guys on REE and Passenger for a thorough treatment on the GC benefits.
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.
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.
Today, even cell phones have multi core processors in them. Moore's law continues on, meaning the number of cores will be doubling every 3 years. A global VM lock is simply no longer acceptable for serious programming, especially for server applications.
Thread is only one way of doing multi-processing. It´s more like vertical scalling vs horizontal scalling problem. Both can do the job with they're advantages/disadvantages.
7
u/postmodern Feb 24 '13 edited Feb 24 '13
They also
replaced mark/sweep withoptimized GC using bitmap marking to make it copy-on-write friendly!