Bird
0
0

Which statement best describes how Ruby threads are scheduled and executed?

hard📝 Conceptual Q10 of 15
Ruby - Concurrent Programming
Which statement best describes how Ruby threads are scheduled and executed?
ARuby threads are native OS threads scheduled preemptively by the OS.
BRuby threads are green threads managed by Ruby interpreter with cooperative scheduling.
CRuby threads run sequentially and never in parallel.
DRuby threads require manual switching to run concurrently.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Ruby thread model

    Modern Ruby (MRI) uses native OS threads scheduled preemptively by the operating system.
  2. Step 2: Eliminate incorrect models

    Green threads and cooperative scheduling are older models not used in current Ruby. Threads can run in parallel on multiple cores.
  3. Final Answer:

    Ruby threads are native OS threads scheduled preemptively by the OS. -> Option A
  4. Quick Check:

    Ruby threads = native OS threads with preemptive scheduling [OK]
Quick Trick: Ruby threads are native OS threads, scheduled preemptively [OK]
Common Mistakes:
  • Thinking Ruby uses green threads
  • Assuming threads run sequentially only
  • Believing manual switching is needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes