Bird
0
0

Which of the following is a direct consequence of Ruby's GIL on multi-threaded programs?

easy📝 Conceptual Q2 of 15
Ruby - Concurrent Programming

Which of the following is a direct consequence of Ruby's GIL on multi-threaded programs?

AThreads are serialized when executing Ruby code.
BThreads run in true parallel on multiple CPU cores.
CThreads cannot be created in Ruby.
DThreads automatically share CPU time equally without locking.
Step-by-Step Solution
Solution:
  1. Step 1: Recall GIL behavior

    The GIL forces threads to take turns running Ruby code, so they do not run in parallel.
  2. Step 2: Understand serialization

    This means threads are serialized (run one after another) when executing Ruby code.
  3. Final Answer:

    Threads are serialized when executing Ruby code. -> Option A
  4. Quick Check:

    GIL consequence = thread serialization [OK]
Quick Trick: GIL causes threads to run one at a time in Ruby [OK]
Common Mistakes:
  • Assuming threads run in parallel on multiple cores
  • Believing Ruby disallows thread creation
  • Confusing CPU scheduling with GIL locking

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes