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.