De GVL (Global VM Lock, voorheen GIL) in MRI Ruby staat slechts één thread toe om Ruby-code tegelijk uit te voeren — dus threads bieden geen echte CPU-parallelisme. Maar de GVL wordt vrijgegeven tijdens I/O, dus threads helpen wel bij I/O-gebonden werk. Voor CPU-parallelisme gebruik je meerdere processen. Dit weerspiegelt de GIL-situatie in Python.
De GVL: één thread voert Ruby-code tegelijk uit
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.
