Kqueue
Kqueue is a scalable event notification interface introduced in FreeBSD 4.1 in July 2000, also supported in NetBSD, OpenBSD, DragonFly BSD, and macOS. Kqueue was originally authored in 2000 by Jonathan Lemon, then involved with the FreeBSD Core Team. Kqueue makes it possible for software like nginx to solve the c10k problem. The term "kqueue" refers to its function as a "kernel event queue" 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 poll(2) and select(2) which are less efficient, especially when polling for events on numerous 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. Furthermore, kqueue provides a way to use user-defined events in addition to the ones provided by the kernel.…
Kqueue is a scalable event notification interface introduced in FreeBSD 4.1 in July 2000, also supported in NetBSD, OpenBSD, DragonFly BSD, and macOS. Kqueue was originally authored in 2000 by Jonathan Lemon, then involved with the FreeBSD Core Team. Kqueue makes it possible for software like nginx to solve the c10k problem. The term "kqueue" refers to its function as a "kernel event queue" 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 poll(2) and select(2) which are less efficient, especially when polling for events on numerous 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. Furthermore, kqueue provides a way to use user-defined events in addition to the ones provided by the kernel. Some other operating systems which traditionally only supported select(2) and poll(2) also currently provide more efficient polling alternatives, such as epoll on Linux and I/O completion ports on Windows and Solaris. libkqueue is a user space implementation of kqueue(2) , which translates calls to an operating system's native backend event mechanism. int kqueue(void); Creates a new kernel event queue and returns a descriptor. int kevent(int kq, const struct kevent* changelist, int nchanges, struct kevent* eventlist, int nevents, const struct timespec* timeout); Used to register events with the queue, then wait for and return any pending events to the user. In contrast to epoll, kqueue uses the same function to register and wait for events, and multiple event sources may be registered and modified using a single call. The changelist array can be used to pass modifications (changing the type of events to wait for, register new event sources, etc.) to the event queue, which are applied before waiting for events begins. nevents is the size of the user supplied eventlist array that is used to receive events from the event queue. EV_SET(kev, ident, filter, flags, fflags, data, udata); A macro that is used for convenient initialization of a struct kevent object. ==External links== libbrb_core implements an abstraction for an event-oriented base, using kqueue() system call FreeBSD source code of the kqueue() system call OpenBSD source code of the kqueue() system call NetBSD source code of the kqueue() system call DragonFly BSD source code of the kqueue() system call
References
- libkqueue on GitHub Wikipedia revision 1317212447, retrieved 2026-11-20 · retrieved 2026-11-19 · rev 1317212447
Cite this reference
MLA "libkqueue on GitHub Wikipedia revision 1317212447, retrieved 2026-11-20." 2026-11-19. https://github.com/mheily/libkqueue. Accessed 23 November 2026.
Chicago "libkqueue on GitHub Wikipedia revision 1317212447, retrieved 2026-11-20." 2026-11-19. https://github.com/mheily/libkqueue.
APA encyclopegia.org. (2026). libkqueue on GitHub Wikipedia revision 1317212447, retrieved 2026-11-20. Retrieved November 23, 2026, from https://github.com/mheily/libkqueue
- kqueue(2) – FreeBSD System Calls Manual Wikipedia revision 1317212447, retrieved 2026-11-20 · retrieved 2026-11-19 · rev 1317212447
Cite this reference
MLA "kqueue(2) – FreeBSD System Calls Manual Wikipedia revision 1317212447, retrieved 2026-11-20." 2026-11-19. https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2. Accessed 23 November 2026.
Chicago "kqueue(2) – FreeBSD System Calls Manual Wikipedia revision 1317212447, retrieved 2026-11-20." 2026-11-19. https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2.
APA encyclopegia.org. (2026). kqueue(2) – FreeBSD System Calls Manual Wikipedia revision 1317212447, retrieved 2026-11-20. Retrieved November 23, 2026, from https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
- §14. nginx · retrieved 2026-11-19 · rev 1317212447
Cite this reference
MLA "§14. nginx." Andrew Alexeev (2012). 2026-11-19. http://www.aosabook.org/en/nginx.html. Accessed 23 November 2026.
Chicago "§14. nginx." Andrew Alexeev (2012). 2026-11-19. http://www.aosabook.org/en/nginx.html.
APA Andrew Alexeev (2012). (2026). §14. nginx. Retrieved November 23, 2026, from http://www.aosabook.org/en/nginx.html
- kqueue, kevent — kernel event notification mechanism · retrieved 2026-11-19 · rev 1317212447
Cite this reference
MLA "kqueue, kevent — kernel event notification mechanism." a b c Jonathan Lemon (2000). 2026-11-19. http://bxr.su/f/lib/libc/sys/kqueue.2. Accessed 23 November 2026.
Chicago "kqueue, kevent — kernel event notification mechanism." a b c Jonathan Lemon (2000). 2026-11-19. http://bxr.su/f/lib/libc/sys/kqueue.2.
APA a b c Jonathan Lemon (2000). (2026). kqueue, kevent — kernel event notification mechanism. Retrieved November 23, 2026, from http://bxr.su/f/lib/libc/sys/kqueue.2
- Connection processing methods · retrieved 2026-11-19 · rev 1317212447
Cite this reference
MLA "Connection processing methods." 2026-11-19. http://nginx.org/en/docs/events.html. Accessed 23 November 2026.
Chicago "Connection processing methods." 2026-11-19. http://nginx.org/en/docs/events.html.
APA encyclopegia.org. (2026). Connection processing methods. Retrieved November 23, 2026, from http://nginx.org/en/docs/events.html
- KQueue–A Generic and Scalable Event Notification Facility · retrieved 2026-11-19 · rev 1317212447
Cite this reference
MLA "KQueue–A Generic and Scalable Event Notification Facility." a b c Jonathan Lemon (2001-05-01). 2026-11-19. http://people.freebsd.org/~jlemon/papers/kqueue.pdf. Accessed 23 November 2026.
Chicago "KQueue–A Generic and Scalable Event Notification Facility." a b c Jonathan Lemon (2001-05-01). 2026-11-19. http://people.freebsd.org/~jlemon/papers/kqueue.pdf.
APA a b c Jonathan Lemon (2001-05-01). (2026). KQueue–A Generic and Scalable Event Notification Facility. Retrieved November 23, 2026, from http://people.freebsd.org/~jlemon/papers/kqueue.pdf
- GitHub|https://github.com/mheily/libkqueue . · retrieved 2025-10-15 · rev 1317212447
Cite this reference
MLA "GitHub|https://github.com/mheily/libkqueue ." GitHub|https://github. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447. Accessed 23 November 2026.
Chicago "GitHub|https://github.com/mheily/libkqueue ." GitHub|https://github. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447.
APA GitHub|https://github. (2025). GitHub|https://github.com/mheily/libkqueue . Retrieved November 23, 2026, from https://en.wikipedia.org/w/index.php?oldid=1317212447
- Jonathan Lemon. Kqueue: A generic and scalable event notification facility . 2001-05-01. · retrieved 2025-10-15 · rev 1317212447
Cite this reference
MLA "Jonathan Lemon. Kqueue: A generic and scalable event notification facility . 2001-05-01." Jonathan Lemon. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447. Accessed 23 November 2026.
Chicago "Jonathan Lemon. Kqueue: A generic and scalable event notification facility . 2001-05-01." Jonathan Lemon. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447.
APA Jonathan Lemon. (2025). Jonathan Lemon. Kqueue: A generic and scalable event notification facility . 2001-05-01. Retrieved November 23, 2026, from https://en.wikipedia.org/w/index.php?oldid=1317212447
- Jonathan Lemon. kqueue, kevent — kernel event notification mechanism . BSD Cross Reference . 2000. · retrieved 2025-10-15 · rev 1317212447
Cite this reference
MLA "Jonathan Lemon. kqueue, kevent — kernel event notification mechanism . BSD Cross Reference . 2000." Jonathan Lemon. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447. Accessed 23 November 2026.
Chicago "Jonathan Lemon. kqueue, kevent — kernel event notification mechanism . BSD Cross Reference . 2000." Jonathan Lemon. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447.
APA Jonathan Lemon. (2025). Jonathan Lemon. kqueue, kevent — kernel event notification mechanism . BSD Cross Reference . 2000. Retrieved November 23, 2026, from https://en.wikipedia.org/w/index.php?oldid=1317212447
- Connection processing methods . nginx.org . · retrieved 2025-10-15 · rev 1317212447
Cite this reference
MLA "Connection processing methods . nginx.org ." Connection processing methods. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447. Accessed 23 November 2026.
Chicago "Connection processing methods . nginx.org ." Connection processing methods. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447.
APA Connection processing methods. (2025). Connection processing methods . nginx.org . Retrieved November 23, 2026, from https://en.wikipedia.org/w/index.php?oldid=1317212447
- Andrew Alexeev. aosabook.org . · retrieved 2025-10-15 · rev 1317212447
Cite this reference
MLA "Andrew Alexeev. aosabook.org ." Andrew Alexeev. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447. Accessed 23 November 2026.
Chicago "Andrew Alexeev. aosabook.org ." Andrew Alexeev. 2025-10-15. https://en.wikipedia.org/w/index.php?oldid=1317212447.
APA Andrew Alexeev. (2025). Andrew Alexeev. aosabook.org . Retrieved November 23, 2026, from https://en.wikipedia.org/w/index.php?oldid=1317212447
Cite this article
MLA
"Kqueue." encyclopegia.org, 2025, https://encyclopegia.org/wiki/kqueue. Accessed 23 November 2026.
Chicago
"Kqueue." encyclopegia.org. Accessed November 23, 2026. https://encyclopegia.org/wiki/kqueue.
APA
encyclopegia.org. (2025). Kqueue. Retrieved November 23, 2026, from https://encyclopegia.org/wiki/kqueue
Accessed November 23, 2026 · CC BY-SA 4.0 · citation page · JSON