* 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
* 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 0:38 Carlo Wood
@ 2001-12-06 0:57 ` Alan Cox
2001-12-06 5:48 ` Benjamin LaHaise
0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2001-12-06 0:57 UTC (permalink / raw)
To: Carlo Wood; +Cc: linux-kernel
> are there any plans to implement the kqueue, kevent system calls
> in the linux kernel?
Not that I know of
> 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.
The standards way is asynchronous io (aio_* interfaces). That is being
worked on
> 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
The API isnt directly the problem. In fact you can make a fine scalable select
by implementing
poll_setup(..............)
poll_add/poll_remove
poll_wait
as multiple calls giving basically the same interface that apps expected
anyway. Take a look at the various /dev/poll experimental interfaces and
bits of code.
Alan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: kqueue, kevent - kernel event notification mechanism
2001-12-06 0:57 ` Alan Cox
@ 2001-12-06 5:48 ` Benjamin LaHaise
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin LaHaise @ 2001-12-06 5:48 UTC (permalink / raw)
To: Alan Cox; +Cc: Carlo Wood, linux-kernel
On Thu, Dec 06, 2001 at 12:57:21AM +0000, Alan Cox wrote:
> The API isnt directly the problem. In fact you can make a fine scalable select
> by implementing
>
> poll_setup(..............)
> poll_add/poll_remove
> poll_wait
>
> as multiple calls giving basically the same interface that apps expected
> anyway. Take a look at the various /dev/poll experimental interfaces and
> bits of code.
My aio patches already have a poll operation, however it acts as a one shot
operation: an async poll does not complete until the state indicates
readiness or it is cancelled. That's needed as there is a 1-1 relationship
between submitted aio operations and the space in the completion ring. Still,
it looks like it will work quite nicely as a means of accelerating exiting
poll() based servers.
-ben
-ben
^ 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 7:33 kqueue, kevent - kernel event notification mechanism Dan Kegel
2001-12-06 14:28 ` Carlo Wood
-- strict thread matches above, loose matches on Subject: below --
2001-12-06 0:38 Carlo Wood
2001-12-06 0:57 ` Alan Cox
2001-12-06 5:48 ` Benjamin LaHaise
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox