You can reuse the same utilities, same libraries like template engines. You can reuse the same templates as well, and utilities like Underscore or Lodash, Superagent or Request. They are very easily either ported to the browser or from the browser to the Node.js. And my personal experience is that I'm thinking 10 times faster when I have just one language. It's faster to learn just one language. You make less mistakes because of the syntax differences. So, having one context and having no context which is very, very, very beneficial for developers.
So, what is a non-blocking I/O or input output? Historically, input and output they are the most expensive operations in your projects, in your applications in your system. So, this is kind of a big deal. In Node.js, we have this non-blocking I/O, which is implemented by the use of the event loop. So, it's a single thread. Why it's a single thread? Because with a single thread we eliminate a lot of complexity like deadlocks and racing conditions.
And we have this event loop, think about it as a "while" or "for" loop that constantly looks for something to execute. And then all the input and output operations they performed on the system level, you could read from the file, write to a file database some expensive computations like hashes and cryptography. And when those operations are ready, when they're done, you get the callback that goes back to event loop, and that's how Node.js can process multiple requests at the same time without having to block your thread. Of course, there are some disadvantages to Node.js as well. So developers, they have to shift their thinking, because asynchronous, it's not natural. It's not how historically most of the developers and software engineers and programmers have learned to program, so it's a little bit functional and you have this prototypal concept as well. So just think in an asynchronous way.
Okay. So, here's a gotcha about Node.js and that very, very amazing thing which is called non-blocking I/O. Non-blocking I/O is probably the most advantageous benefit of all other benefits. So, you can still write a blocking code in Node.js. It's totally possible. So if you have some CPU-intensive tasks, a good architecture would be to either create a new Node.js process so your main Node.js process is not blocked, or you can even use another technology like Python if you have some existing systems already. So, Node.js itself would not enforce you to not use CPU-intensive tasks, not to use expensive I/O. So, you need to be careful about that and use asynchronous non-blocking I/O methods when they are available.
Those are big companies that use Node.js. As you can see the list has very, very prominent web property owners like eBay, Amazon.com, Box, Yahoo, now IBM, Netflix and Capital One are part of this. So, you might hear often this kind of concern that Node.js is a single-threaded system and that's true. Node.js, a single Node.js process is single-threaded. So that's by design because with multi-threading you might encounter some terrible, terrible complexities. And it turns out that the single-threaded, it's really good for asynchronous code and because it keeps it simple, simple enough.
However, when you want to scale that single process how do you do that? So, to do that you would use something called clusters. So you would fork another process. So you would have multiple processes and if it's a web server that you're building you can build multiple processes. You can start multiple processes and they would be listed on the same port.