CodePark/ questions / Runtime, V8 & libuv
START PRACTICINGPRACTICE
Backend question · Node.js › Runtime, V8 & libuv

Which of these operations does NOT use the libuv thread pool?

Reading data from a TCP socket

"Reading data from a TCP socket" is correct. Network sockets use the operating system's own non-blocking I/O, so they never use a pool thread:
• epoll on Linux

• kqueue on macOS

• IOCP on Windows


The other options all run on the libuv thread pool. This includes "
fs.readFile", "crypto.pbkdf2" and "zlib.gzip". The pool also runs other async crypto functions like scrypt, and dns.lookup. They use the pool for two reasons. Some have no non-blocking OS interface that works on every platform. Others are CPU-heavy.