u/jwalton78in r/node • Recommends
On “Is nodejs single threaded or multi threaded”
Ignoring fancy things like worker threads, node.js is *mostly* single threaded. All of your javascript code executes on a single "event loop", all on the same thread.
IO is still *mostly* single threaded. Node.js is based on a library called libuv which handles all the IO.
In a language like Java or Golang, when you want to read from or write to a socket you'd do what's called "blocking" or "synchronous" IO - you'd call into a socket.write() function, and it would block until the data you asked it to write is written (or until some error happens). If you try to socket.read() and there's no data to read, it'll just block until there is some.
But, blocking IO is not the only way to do IO…