Advanced Ruby
Q84 / 100

What is the Global Interpreter Lock (GIL), also called GVL in MRI Ruby, and how does it affect threads?

Correct! Well done.

Incorrect.

The correct answer is B) It ensures only one thread executes Ruby code at a time within a single process, meaning CPU-bound Ruby threads do not achieve true parallelism (though I/O-bound operations can release the lock)

B

Correct Answer

It ensures only one thread executes Ruby code at a time within a single process, meaning CPU-bound Ruby threads do not achieve true parallelism (though I/O-bound operations can release the lock)

Explanation

MRI's Global VM Lock means only one thread runs Ruby bytecode at a time, so CPU-bound multithreading does not provide parallel speedup, though threads can still interleave during I/O waits (and Ractors offer an alternative for parallelism).

Progress
84/100