understanding the ruby global vm lock by observing it
The Global VM Lock (GVL), also known as Global Interpreter Lock (GIL), is an implementation detail of the Ruby VM. At a high-level, it prevents Ruby code across multiple threads from running in parallel (while still allowing concurrency!).
The GVL is an extremely important implementation detail, as it can have a big impact on the performance and responsiveness of any Ruby application that uses more than a single thread to do its work.
I’ve previously blogged (see bottom of the post for links!) about my ongoing experiments building the gvl-tracing
gem to try to learn more about how the GVL works, and how it impacts Ruby apps.
Recently, I had the incredible opportunity to present what I’ve learned so far at the RubyKaigi 2023 conference.
You can find the video and slides for this talk below, and here’s a live link to all the experiments, including code and perfetto links.
Slide deck: