Bird
0
0

Why is workerData considered a snapshot of data rather than a live shared object between main and worker threads?

hard📝 Conceptual Q10 of 15
Node.js - Worker Threads
Why is workerData considered a snapshot of data rather than a live shared object between main and worker threads?
ABecause workerData uses environment variables internally
BBecause workerData is a reference to main thread memory
CBecause workerData is copied and not linked, changes do not sync
DBecause workerData is a proxy object that syncs automatically
Step-by-Step Solution
Solution:
  1. Step 1: Understand data passing mechanism

    workerData is serialized and copied when passed, so it is a snapshot at creation time.
  2. Step 2: Confirm no live syncing

    Changes in main or worker do not affect each other unless explicit messaging or shared memory is used.
  3. Final Answer:

    Because workerData is copied and not linked, changes do not sync -> Option C
  4. Quick Check:

    workerData is a snapshot copy, not live shared data [OK]
Quick Trick: workerData is copied, not live shared memory [OK]
Common Mistakes:
  • Assuming workerData is live shared reference
  • Confusing with SharedArrayBuffer behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes