Re: epoll (was Re: [PATCH] async poll for 2.5)

Charles 'Buck' Krasic (krasic@acm.org)
19 Oct 2002 09:10:52 -0700


Mark Mielke <mark@mark.mielke.cc> writes:

> They still represent an excessive complicated model that attempts to
> implement /dev/epoll the same way that one would implement poll()/select().

epoll is about fixing one aspect of an otherwise well established api.
That is, fixing the scalability of poll()/select() for applications
based on non-blocking sockets.

Yes, programming non-blocking sockets has its complexity. Most people
probably end up writing their own API to simplify things, building
wrapper libraries above. However, a wrapper library can not fix the
performance problems of poll()/select().

epoll() is a relatively modest kernel modification that delivers
impressive performance benefits. It isn't exactly a drop in
replacement for poll()/select(), especially because of the difference
between level and edge semantics. That's why wrapper libraries make
sense.

> Sometimes the answer isn't emulation, or comparability.
>
> Sometimes the answer is innovation.

> mark

Yes, building a better API into the kernel makes sense. Not only to
eliminate wrappers, but to generalize beyond sockets. I went to local
user group meeting this week where a guy gave an overview of what's
new in kernel 2.5. When AIO was presented, the first question was
"why not use nonblocking IO?". I bet more than half the programmers
in the room had no idea that nonblocking flags have absolutely no
effect for files.

It seems to me that most people pushing on AIO so far have been using
it for files, e.g. Oracle. They have no choice. It's either that or
use clumsy worker thread arrangements. Network code on the other
hand, has had non-blocking IO available for years. That's why there
are all kinds of examples of web servers that use threads only for the
disk side of things.

But let's not mix them up. AIO is a new model (for linux anyway),
whose implementation is necessitating fairly major architectural
changes to the kernel.

epoll is a nice well contained fix, that fits neatly into the existing
architecture.

As it happens, epoll will probably have a place in AIO too. But there
is no mutual dependency between them. They are both important on
their own.

-- Buck

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/