GVL (Global VM Lock, ადრე GIL) MRI Ruby-ში საშუალებას აძლევს მხოლოდ ერთ thread-ს გაუშვას Ruby კოდი ერთდროულად — ამიტომ threads არ იძლევა true CPU parallelism. მაგრამ GVL გათავისუფლდება I/O-ს დროს, ამიტომ threads სამართებულია I/O-bound სამუშაოსთვის. CPU parallelism-ისთვის იყენებთ მრავალ processes. ეს Python-ის GIL სიტუაციის მსგავსია.
GVL: ერთი thread ხელმისაწვდომელი Ruby კოდი ერთ დროს
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.
