Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone! I'm a bit confused, and I would be grateful if someone could clarify a few things to me.

Node JS is single threaded and it deals primarily with async code, if operation takes time and is not asynchronous it will block the app. I'm familiar with the concept of Event Loop.
If all this is true, then how Node JS imitate parallelism/concurrency?
What I mean, take for example Async module, and it's async.parallel or async.each methods. Both of them apply passed in function to every element of the array in parallel(documentation).
If callback is not passed in to the methods, they return a promise, so I should await it? All that "juggling", and one promise in the end.
What is happening behind the scene?
I read somewhere, that Node JS is thread safe and lock free (opposite to C# for example), but still don't get it.
Thank you for your time.

What I have tried:

I read some articles on the subject and some documentation, but I still don't get it.
Posted
Updated 18-Jul-19 0:04am

1 solution

This clarifies some of confusion. Node.js async.parallel, is it parallel?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900