||This article may be too technical for most readers to understand. (October 2013)|
Kqueue provides efficient input and output event pipelines between the kernel and userland. Thus, it is possible to modify event filters as well as receive pending events while using only a single system call to
kevent(2) per main event loop iteration. This contrasts with older traditional polling system calls such as
select(2) which are less efficient, especially when polling for events on a large number of file descriptors.
Kqueue not only handles file descriptor events but is also used for various other notifications such as file modification monitoring, signals, asynchronous I/O events (AIO), child process state change monitoring and timers which support nanosecond resolution.
Some other operating systems which traditionally only supported
poll(2) also currently provide more efficient polling alternatives, such as epoll on Linux and I/O Completion Ports on Windows and Solaris.
Kqueue (or related techniques) provides the foundation for scalable event-driven I/O architectures such as Node.js in the web server space.
OS-independent libraries with good support for kqueue:
Kqueue equivalent for other platforms:
|This Unix-related article is a stub. You can help Wikipedia by expanding it.|