GVL (Global VM Lock, यापूर्वी GIL) MRI Ruby मध्ये एकावेळी फक्त एक thread Ruby code execute करू शकतो — त्यामुळे threads true CPU parallelism प्रदान करत नाहीत. परंतु GVL I/O दरम्यान release होती, त्यामुळे threads I/O-bound कार्यसाठी मदत करतात. CPU parallelism साठी, तुम्ही multiple processes वापराल. हे Python च्या GIL परिस्थितीला mirrors करते.
GVL: एकावेळी एक thread Ruby code चालवतो
MRI (the standard Ruby) has a GLOBAL VM LOCK:
→ only ONE thread executes Ruby code at any instant (no CPU parallelism from threads)
→ BUT the GVL is RELEASED during blocking I/O (network, file, DB)
So: threads help for I/O-bound work, NOT for CPU-bound work.
