How many threads run event loop in nodejs

50 views Asked by At

I am checking nodejs internal architecture and was curious about the event loop. So I cloned the node repo and modified the libuv code a little and added printf statements to understand the loop better. Then I build the code and ran an empty js file.

I added a printf statement before uv__io_poll function call

printf("polling io with thread %d\n", tid);

where tid is the thread id.

After running the program, I got the following output

polling io with thread 2242953
polling io with thread 2242949
polling io with thread 2242949
polling io with thread 2242949

Why there are 2 different thread ids?

0

There are 0 answers