What does GIL really guarantee you?
summary
Ruby MRI’s GIL protects only internal C-level data structures (arrays, hashes) not surrounding Ruby code, so GIL protects C internals not Ruby-level operations. A harmless refactor that inserts a method call can introduce a race because MRI does context switches on method call/return, so context switch can happen at any Ruby line. Running with JRuby (no GIL) or turning off extra cores doesn’t fix races; a real production bug exposed other users’ orders via Sidekiq + Shopify API gem + rails active resource.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 1:00What does GIL do
- 1:30My project
- 2:22Race condition
- 9:20Parallelism
- 19:43Context Switching
- 22:18Conclusion








