public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* kqueue, kevent - kernel event notification mechanism
@ 2001-12-06  0:38 Carlo Wood
  2001-12-06  0:57 ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Carlo Wood @ 2001-12-06  0:38 UTC (permalink / raw)
  To: linux-kernel

Hiya,

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.

It would be good for linux to implement event-driven i/o, if not
by means of kqueue/kevent (BSD-ish interface) then at least in
some other way.

It has been shown that a heavily loaded networking daemon like
an IRC daemon uses 35% less cpu on freeBSD by using event-driven
i/o instead of poll().

For those who are not into this material, allow me to explain
the difference.  The current i/o calls, select and poll, scan all
open file descriptors for events, every call.  This is clearly
not scalable.  Event driven means that the kernel never scans
all open file descriptors but queues events as they happen on
the network card - the latter would in principle be scalable
to any number of open file descriptors, as long as there is
enough memory and as long as there is a limited number of
file descriptors active per time unit.

-- 
Carlo Wood <carlo@alinoe.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread
* re: kqueue, kevent - kernel event notification mechanism
@ 2001-12-06  7:33 Dan Kegel
  2001-12-06 14:28 ` Carlo Wood
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Kegel @ 2001-12-06  7:33 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, Carlo Wood

Carlo Wood <carlo@alinoe.com> wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-12-06 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-06  0:38 kqueue, kevent - kernel event notification mechanism Carlo Wood
2001-12-06  0:57 ` Alan Cox
2001-12-06  5:48   ` Benjamin LaHaise
  -- strict thread matches above, loose matches on Subject: below --
2001-12-06  7:33 Dan Kegel
2001-12-06 14:28 ` Carlo Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox