GVL (Global VM Lock, awali GIL) katika MRI Ruby huruhusu thread moja tu kuendesha code ya Ruby kwa wakati mmoja — hivyo threads hazitoi CPU parallelism halisi. Lakini GVL huachiliwa wakati wa I/O, hivyo threads zinasaidia kwa kazi za I/O-bound. Kwa CPU parallelism, hutumia processes nyingi. Hii inafanana na hali ya GIL ya Python.
GVL: thread moja huendesha code ya Ruby kwa wakati mmoja
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.
