News for hackers. Stuff that matters.
Re:How JavaScript works: Event loop and the rise of Async pr... by yomly on Saturday October 14, 2017 @03:52PM (#15473864)
I'm a noob to concurrency, but my current understanding is that a "thread" is "virtual". Fundamentally, your CPU has finite cores so no matter how many threads you spawn your (individual) CPU cores will resolve the threads into a synchronous set of instructions to execute.

Having a single threaded (asynchronous) server simply displaces the abstraction of threads.

Please feel free to correct if I'm wrong about this...

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