Skip to contentSkip to conversation

kqueue, kevent - kernel event notification mechanism

DISCUSSION Dan Kegel 2 participants 2 messages Dec 6, 2001

lore
Share & tools
lore

Dan Kegel

author
#0 lore raw
Quoted 6 lines · Carlo Wood

are there any plans to implement the kqueue, kevent system calls in the linux kernel?

There is no substitute for them currently; select() and poll() both suffer from dramatic cpu usage when a daemon is loaded with a few thousand clients.

There is already an efficient mechanism - although with a very different interface - in the 2.4.x kernel: edge triggered readiness notification via realtime signals. This matches one style of kqueue()/kevent() usage. For those who prefer level-triggered readiness notification (more like what poll() gives you), I have written a wrapper class that papers over the difference efficiently, at the cost of making the app tell my class about all the EWOULDBLOCKs it gets.
See http://www.kegel.com/c10k.html#nb.sigio for details. I don't particularly like signals for this, as they're a bit heavyweight, and the global signal queue is a bit precious, but it does benchmark well, even for thousands of clients.

(That page also describes kqueue etc. and the experimental /dev/poll drivers.)
- Dan

#1 lore raw
Quoted 1 line · Dan Kegel

See http://www.kegel.com/c10k.html#nb.sigio for details.

Wow! Thanks for writing that *wonderful* page!!! That is exactly the documentation I was looking for to improve my 'An Object Oriented Core library for Event Driven Applications' library (http://libcw.sourceforge.net/), a library intended for Heavy Duty networking applications that I've been working on for the past few years.

Thanks!

Signature · 1 line
Carlo Wood <[email protected]>