Bird
0
0

Why does Node.js cluster module use separate worker processes instead of threads for load balancing?

hard📝 Conceptual Q10 of 15
Node.js - Cluster Module
Why does Node.js cluster module use separate worker processes instead of threads for load balancing?
ABecause Node.js runs JavaScript in a single thread and processes avoid blocking
BBecause threads are slower than processes in Node.js
CBecause processes share memory more easily than threads
DBecause threads cannot handle HTTP requests
Step-by-Step Solution
Solution:
  1. Step 1: Understand Node.js threading model

    Node.js runs JavaScript on a single thread, so it uses processes to achieve parallelism.
  2. Step 2: Explain why processes are preferred

    Processes avoid blocking the event loop and allow true parallel execution, unlike threads in Node.js.
  3. Final Answer:

    Because Node.js runs JavaScript in a single thread and processes avoid blocking -> Option A
  4. Quick Check:

    Processes used due to single-threaded JS [OK]
Quick Trick: Processes avoid blocking single-threaded JS [OK]
Common Mistakes:
  • Thinking threads are slower than processes
  • Assuming processes share memory easily
  • Believing threads can't handle HTTP

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes