문제

I opened my activity monitory in OSX to to see how Node was getting along and to my surprise it's using 8 threads. How can in be!!?

Node with 8 threads

도움이 되었습니까?

해결책

Node.js is single-threaded.

However, it is built on libuv which handles all low-level platform-dependent stuff, including async IO.

Now the issue is that there is no good API for async IO in operating systems nowadays. Different APIs exist, but they all have their issues.

So in order to implement cross-platform async API, libuv emulates it using a thread pool. This is where those threads are coming from.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top