<s>
Kqueue	B-Application
is	O
a	O
scalable	O
event	O
notification	O
interface	O
introduced	O
in	O
FreeBSD	B-Operating_System
4.1	O
in	O
July	O
2000	O
,	O
also	O
supported	O
in	O
NetBSD	B-Device
,	O
OpenBSD	B-Operating_System
,	O
DragonFly	B-Application
BSD	I-Application
,	O
and	O
macOS	B-Application
.	O
</s>
<s>
Kqueue	B-Application
was	O
originally	O
authored	O
in	O
2000	O
by	O
Jonathan	O
Lemon	O
,	O
then	O
involved	O
with	O
the	O
FreeBSD	B-Application
Core	I-Application
Team	I-Application
.	O
</s>
<s>
Kqueue	B-Application
makes	O
it	O
possible	O
for	O
software	O
like	O
nginx	B-Operating_System
to	O
solve	O
the	O
c10k	B-Protocol
problem	I-Protocol
.	O
</s>
<s>
Kqueue	B-Application
provides	O
efficient	O
input	O
and	O
output	O
event	O
pipelines	O
between	O
the	O
kernel	B-Operating_System
and	O
userland	O
.	O
</s>
<s>
Thus	O
,	O
it	O
is	O
possible	O
to	O
modify	O
event	O
filters	O
as	O
well	O
as	O
receive	O
pending	O
events	O
while	O
using	O
only	O
a	O
single	O
system	B-Operating_System
call	I-Operating_System
to	O
kevent(2 )	O
per	O
main	O
event	B-General_Concept
loop	I-General_Concept
iteration	O
.	O
</s>
<s>
This	O
contrasts	O
with	O
older	O
traditional	O
polling	B-General_Concept
system	B-Operating_System
calls	I-Operating_System
such	O
as	O
poll(2 )	O
and	O
select(2 )	O
which	O
are	O
less	O
efficient	O
,	O
especially	O
when	O
polling	B-General_Concept
for	O
events	O
on	O
numerous	O
file	B-Application
descriptors	I-Application
.	O
</s>
<s>
Kqueue	B-Application
not	O
only	O
handles	O
file	B-Application
descriptor	I-Application
events	O
but	O
is	O
also	O
used	O
for	O
various	O
other	O
notifications	O
such	O
as	O
file	B-Application
modification	I-Application
monitoring	I-Application
,	O
signals	B-Operating_System
,	O
asynchronous	B-Architecture
I/O	I-Architecture
events	O
(	O
AIO	O
)	O
,	O
child	B-Operating_System
process	I-Operating_System
state	O
change	O
monitoring	O
,	O
and	O
timers	O
which	O
support	O
nanosecond	O
resolution	O
,	O
furthermore	O
kqueue	B-Application
provides	O
a	O
way	O
to	O
use	O
user-defined	O
events	O
in	O
addition	O
to	O
the	O
ones	O
provided	O
by	O
the	O
kernel	B-Operating_System
.	O
</s>
<s>
Some	O
other	O
operating	B-General_Concept
systems	I-General_Concept
which	O
traditionally	O
only	O
supported	O
select(2 )	O
and	O
poll(2 )	O
also	O
currently	O
provide	O
more	O
efficient	O
polling	B-General_Concept
alternatives	O
,	O
such	O
as	O
epoll	B-Application
on	O
Linux	B-Application
and	O
I/O	B-Library
completion	I-Library
ports	I-Library
on	O
Windows	B-Application
and	O
Solaris	B-Application
.	O
</s>
<s>
libkqueue	O
is	O
a	O
user	B-Operating_System
space	I-Operating_System
implementation	O
of	O
kqueue(2 )	O
,	O
which	O
translates	O
calls	O
to	O
an	O
operating	B-General_Concept
system	I-General_Concept
's	O
native	O
backend	O
event	O
mechanism	O
.	O
</s>
<s>
Creates	O
a	O
new	O
kernel	B-Operating_System
event	O
queue	O
and	O
returns	O
a	O
descriptor	O
.	O
</s>
<s>
In	O
contrast	O
to	O
epoll	B-Application
,	O
kqueue	B-Application
uses	O
the	O
same	O
function	O
to	O
register	O
and	O
wait	O
for	O
events	O
,	O
and	O
multiple	O
event	O
sources	O
may	O
be	O
registered	O
and	O
modified	O
using	O
a	O
single	O
call	O
.	O
</s>
