As I have understood so far: Javascript is single threaded. If you defer the execution of some procedure, you just schedule it (queue it) to be run next time the thread is free. But Async.js defines two methods: Async::parallel & Async::parallelLimit
, and I quote:
- parallel(tasks, [callback])
Run an array of functions in parallel, without waiting until the previous function has completed. If any of the functions pass an error to its callback...
- parallelLimit(tasks, limit, [callback])
The same as parallel only the tasks are executed in parallel with a maximum of "limit" tasks executing at any time.
As far as to my understanding of English, when you say: "doing tasks in parallel" means doing them at the same time - simultaneously.
How may Async.js execute tasks in parallel in a single thread? Am I missing something.
See Question&Answers more detail:os