Re:How JavaScript works: Event loop and the rise of Async pr...
by dahart on Saturday October 14, 2017 @04:19PM
(#15474047)
No, async & single-threaded is not an abstract replacement for threads. Single-threaded async code can only use 1 CPU core at a time. For example, JS running in the browser without web workers. Multi-threaded uses multiple cores simultaneously.
Whether a thread is "virtual" - I don't know what that means to you, but threads are a primitive the OS provides. Some CPUs have hardware support for threads, and some don't. So, I suspect they are less virtual than you're thinking.
Re:How JavaScript works: Event loop and the rise of Async pr...
by gpderetta on Saturday October 14, 2017 @04:12PM
(#15474001)
Yes, but you need at least as many thread or processes as you have cores to take advantage of them.
A multicore cpu is wasted on single threaded program unless you are lucky enough that your problem is so embarassingly parallel that can be handled by N indipendent the processes
Having a single threaded (asynchronous) server simply displaces the abstraction of threads.
Please feel free to correct if I'm wrong about this...