4

I have been reading around how nodejs uses libuv to perform asynchronous I/O. Reading more about it give me a feeling that it almost sound similar to how select(2) and epoll.

So, my question if I'm using libuv(via node) is it true internally I using select(2) or epoll.

Is libuv is wrapper over select(2) and epoll system call in unix.?

Noobie
  • 461
  • 1
  • 12
  • 34

1 Answers1

8

libuv uses the most performant polling mechanism for every platform: that means epoll on Linux, kqueue on macOS and BSDs, /dev/poll on SunOS, etc. One interesting trick libuv does is it uses select() on a thread for some fds kqueue is unable to handle. I gave some details about that here: http://code.saghul.net/index.php/2016/05/24/libuv-internals-the-osx-select2-trick/

saghul
  • 1,990
  • 1
  • 13
  • 15