3 ms·
It is not what is widely understood as concurrency and the documentation for Promise type is clear in that regard. Nothing happens concurrently (at the same ti
by 29athrowaway 3y ago
It is not what is widely understood as concurrency and the documentation for Promise type is clear in that regard.
Nothing happens concurrently (at the same time), only asynchronously (at different times).
From the documentation:
> Note that JavaScript is single-threaded by nature, so at a given instant, only one task will be executing, although control can shift between different promises, making execution of the promises appear concurrent. Parallel execution in JavaScript can only be achieved through worker threads.
I hope that explains it for you.
- joeycumines 3y agoConcurrency != Parallel execution
- 29athrowaway 3y agoIn JS, without worker threads or similar situations, you don't have real race conditions. Therefore, concurrency primitives like mutexes, read/write locks, condition variables, barriers, semaphores, etc. are not necessary. Or Go-like channels. You can use a global variable and it will be fine because it won't be accessed simultaneously. So then how is this not cargo culting Go? imitating the observable parts of Go without truly understanding what it does?
- joeycumines 3y agoWhat makes data races not a "real race condition"? Anyhow, do what you will. I don't get the impression that you are genuinely interested in this topic.
- 29athrowaway 3y agoThanks for conceding the point. Have fun.