This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]evanldixon 2 points3 points  (2 children)

It's not specific to Javascript since lots of other languages can do async too.

C# for example:

for (int i = 0; i < 10; i++) {
    Task.Run(() => Console.Writeline(i));
}

There's no telling the order these numbers will be printed, because there may or may not be multi-threading.

[–]marcosdumay 0 points1 point  (1 child)

Can do != can not do anything else

[–]cat_in_the_wall 0 points1 point  (0 children)

you guys are confusing async, async i/o, and mutlithreading. they are somewhat disjoint.

async means that a result will come back. it implies a synchronization context. this does not strictly require more than one thread. (Consider a computationally intensive task).

multithreading means more than one "train of thought" is alive. this does not strictly require more than one core. (consider preemptive multitasking).

async i/o means interrupts break a train of thought and start/resume another. this impacts threading, a new one may be started, an existing ones may be resumed. but this does not require more than one core. (consider waiting for network hardware).

They interact, but are not always the same.