Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
donuts238486yJust wondering if you run multiple node.exes on a single PC, different CPUs and have them all communicate/share same code via socket, would that be considered multithreading?
-
olback109816yIsn't every script you start its own thread?
node s1.js
node s2.js
Wouldn't that be two threads? -
@olback actually that would be two processes. The downside of that approach is that for s1.js and s2.js communicate between each other you'd have to build some inter process communication scheme.
The single thread OP refers to is the mechanism by which Node operates - the event loop - which is indeed single threaded. -
Adding the seemingly mandatory 2018 trend to this thread. Bundle your nodejs app into a container and spin up a kubernetes cluster thats limits 1 cpu for each container and then wonder that you just wanted to write a hello world program so what the hell went wrong?
-
Root825576yIf you think tracking is a problem now, wait until WebASM. There will be no way to block it except via DNS, and the malicious trackers' response to that will be the services themselves proxying the tracking along with their own data. The only answer at that point is abstinence... or (possibly) WebASM anti-virus.
Dark days of ubiquitous black boxes ahead.
Related Rants
I'm not much a fan of JavaScript. In fact, I am not very fond of any dynamic language, but JavaScript is one of my least favorites.
But this isn't about that. I use NodeJS for all of my web serving. Why would I do that? Am I a masochist? Yes.
But this isn't about that. I use NodeJS because having the same language on client and server side is something that web has never really seen before, not in this scale. Something I really really love with NodeJS is socket connections. There's no JSON parsing, no annoying conversion of data types. You can get network data and use it AS IS. If you transmit over socket using JSON, as soon as that data arrives on the server, it is available to use. It gets me so hard.
JavaScript is built to be single-threaded, and this is rooted deep into the language. NodeJS knows this isn't gonna work. And while there's still no way to multi-thread, they still try their best and allow certain operations (Usually IO) to run async as if you were using ajax.
With modern versions of the language, the server and client side can share scripts! With the inclusion of the import keyword, for the first time I have ever seen, client and server can use the same fucking code. That is mindblowing.
Syntax is still fluffy and data types are still mushy but the ability to use the same language on both sides is respectable. Can't wait for WebASM to go mainstream and open this opportunity up to more languages!
rant
js