Bird
0
0

What does the Global Interpreter Lock (GIL) in Ruby do?

easy📝 Conceptual Q11 of 15
Ruby - Concurrent Programming

What does the Global Interpreter Lock (GIL) in Ruby do?

AAutomatically speeds up all multi-threaded Ruby programs
BAllows multiple threads to run Ruby code simultaneously
CPrevents any threads from running in Ruby
DAllows only one thread to execute Ruby code at a time
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of GIL

    The GIL is a lock that ensures only one thread runs Ruby code at once.
  2. Final Answer:

    Allows only one thread to execute Ruby code at a time -> Option D
  3. Quick Check:

    GIL = single-thread execution [OK]
Quick Trick: GIL means one thread runs Ruby code at a time [OK]
Common Mistakes:
  • Thinking GIL allows true parallel Ruby code execution
  • Believing GIL stops all threading
  • Assuming GIL speeds up multi-threading

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes