r/learnjavascript • • May 01 '20

Async vs. Sync

Post image
413 Upvotes

81 comments sorted by

View all comments

Show parent comments

0

u/[deleted] May 02 '20

[deleted]

-14

u/[deleted] May 02 '20

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.

13

u/HeinousTugboat May 02 '20

You, uh, just gonna skip over the first example they gave? Node can definitely spawn threads you control.

So.. yeah. Sometimes it's multihtreaded.

1

u/[deleted] May 03 '20

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.

1

u/HeinousTugboat May 03 '20

You just bored and decide to reply again?

0

u/[deleted] May 03 '20

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.

2

u/HeinousTugboat May 03 '20

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?

→ More replies (0)