This is only one specific perspective that could be misleading. You can have the same graph using only asynchronous calls. On the left you could have synchronous asynchronous (one promise after another) and on the right you could have asynchronous asynchronous (Promise.all).
What I’m trying to say is that just because your calls are asynchronous doesn’t mean they are happening at the same time. You have to do that purposefully.
You don't control it though. The operating system does. So it definitely may not be and a lot of people don't trust web workers. https://youtu.be/cN_DpYBzKso
So please stop saying it runs in parallel. It's not.
No you don't control them. You control how they use buffers to bind to the os pthreads but you don't control how they start, how they communicate, their memory, how many, pretty much anything besides the binding.
No just really tired of tutorials and many many devs thinking JavaScript is multithreaded or parallel. This needs to stop. JavaScript never was and can't be more then single threaded. Stop saying it is. At most with the browser/pthreads you get is the ability to lob logic on another thread whenever you use up too much memory..... That's it. That's all it is and that's all it should be called. Otherwise you get all these people saying it's something it's completely not and never will be.
So, pthreads aren't multithreaded? Node doesn't use V8 for threading, it uses libuv which has its own threading API that Node interfaces with. I, admittedly, have no idea what you're referring to when you say that "at most you get the ability to lob logic whenever you use up too much memory".
If pthreads aren't multithreaded, then what do you mean when you say multithreading in a language? I can write a short node program that will run on four cores on my processor. Full stop. That, to most people I imagine, is multithreading. So what's missing from that definition to you?
Anyway, all of this is also ignoring the fact that you can fork your heart out in node. Does this mean it's still not multithreaded? Because at that point is there any language that's multithreaded on a POSIX system?
75
u/ramsncardsfan7 May 01 '20 edited May 01 '20
This is only one specific perspective that could be misleading. You can have the same graph using only asynchronous calls. On the left you could have synchronous asynchronous (one promise after another) and on the right you could have asynchronous asynchronous (Promise.all).
What I’m trying to say is that just because your calls are asynchronous doesn’t mean they are happening at the same time. You have to do that purposefully.