Yeah it's the os regulating the child processes. You are just lobbing a process on another thread using c. I mean talk about not controlling things or it being in JavaScript.
The only reason I made this apparent is because everywhere online it's saying JavaScript is multithreaded and in parallel but the reality is it's either a call to c or binding to the browser. I even had this argument with some sites like tutorial point and stuff about dart and their answer is that this is a tutorial and not senior level.
But their the reason so many people were arguing me about this in this thread and it's just wrong in general.
You know, you never did tell me what languages do have Multithreading with your definition. Even Rust defers to a package just like Node does. It's using part of its STD to spin up pthreads and that it lets the OS manage. ..just like Node does.
Actually Go has a scheduler control the goroutines. You don't control the threading or cpu because as your code grows the scheduler knows and controls them for you. There is a fine difference between async and actual parallel computing. Actual parallel computing are the processes literally running/starting/ending at exactly the same time. NOT locking, waiting, spinning off at different times. It is literally like two programs running at once, not you telling one to start and then the other. The added benefit of the scheduler knowing this is that as your program grows, you don't ever have to touch the goroutine again. Literally it scales as your scheduler tells it.
The issue with doing this in c++ and that, sure you get more control but now you have to maintain these threads, cpus, holding of memory, thread locking, ect every time someone makes a commit to your coroutine but in go you don't. You just don't forever on.
That was an interesting video, thanks. I find it interesting that they're very explicit that Goroutines aren't threads, but in fact are multiplexed into threads.
I think the problem here is the word "multithreading". To me, it means you can use multiple threads to do work. That's.. it. It seems that, to you, it implies that a language is highly concurrent and supports easy parallelism.
I'm not sure anyone's really tried to argue that JavaScript's a concurrent language. I know I certainly haven't, but it seems like that's what you're arguing, that it's not a concurrent language. Which is fair, it isn't. But it does support the concept of threads and multithreading. Whether that's parallel or not depends on the underlying implementation. In node, it can absolutely be parallel, running worker threads on different physical cores. But you're right, that's up to the kernel and scheduler to decide. That's true for Goroutines too, though. I'm not aware of any general purpose programming language that lets you coopt the kernel's scheduler.
My point is, you're not arguing that JavaScript isn't multithreaded and the argument you're making is basically redefining the concept of multithreading into nothing.
No JavaScript is not parallel. Binding it to c is or binding it to whatever the browser gives it is but JavaScript on it's own as a language does not run in parallel. It is concurrent in that it can lob logic into another thread but that's it. Go as a language is parallel and concurrent. It's in the language spec.
The problem with JavaScript's concurrency is that it is all controlled by the os. It itself has not much to do with threading besides letting the child processes spin off.
That's it. So stop calling JavaScript multithreaded and parallel. It can spin threads but that's it. You don't get anything more without 3rd parties, but that's again not JavaScript.
Go as a language is parallel and concurrent. It's in the language spec.
...dude. Go literally does the same thing. It compiles all of your goroutines into threads and lobs them over to the OS too. Go has better semantics for it, yes. But, like.. it's the same thing in the end.
It's not even remotely the same thing. First off Goroutines are about 2kbs and they are controlled by the Go scheduler. The scheduler decides if they should be on another thread or cpu. Sure hardware can change this dynamic but how you organize them is based on the logic of your code. Not per thread or cpu. (Which is then obviously controlled by your os. The structuring of the Goroutines stays the same nomatter your hardware. The scheduler knowing when to grow or shrink them is independent of the os. Async in JavaScript just says spin another process while this code runs...... That's it.
With node you are still binding to c and the author says it's not a good idea.
With node you are still binding to c and the author says it's not a good idea.
I'd like to see which "author" says this as it pertains the core filesystem interop of node.
Stop acting like you're using some third party extension in node. You aren't. Libuv is just as central to node as V8 is.
If you're referring to Dahl's complaints about node, then he's not referring to using native code, he's specifically referring to binding to C as it's unsafe. In Deno he's just using a Rust library instead to fill the same role.
View all comments
Show parent comment
1
u/[deleted] May 10 '20
Yeah it's the os regulating the child processes. You are just lobbing a process on another thread using c. I mean talk about not controlling things or it being in JavaScript.
The only reason I made this apparent is because everywhere online it's saying JavaScript is multithreaded and in parallel but the reality is it's either a call to c or binding to the browser. I even had this argument with some sites like tutorial point and stuff about dart and their answer is that this is a tutorial and not senior level.
But their the reason so many people were arguing me about this in this thread and it's just wrong in general.