[Python-Dev] epoll implementation

Ross Cohen rcohen at snurgle.org
Fri May 26 19:13:44 CEST 2006


On Fri, May 26, 2006 at 11:47:43AM -0500, skip at pobox.com wrote:
> 
>     Ross> I wrote an epoll implementation which can be used as a drop-in
>     Ross> replacement for parts of the select module
>     ...
>     Ross> Is there any interest in incorporating this into the standard
>     Ross> python distribution?
> 
> Without going to the trouble of downloading epoll (always an adventure with
> SourceForget), can you explain what epoll does, how it's better than (parts
> of) select, how widely it's used and how stable it is?

Sure, I can provide a short version of what's on this page:
http://www.kegel.com/c10k.html

epoll is a replacement for the standard poll() system call. It's available
on Linux, introduced sometime during the 2.5 development series. Whereas poll
requires that an fd list be maintained in userspace and handed in on every
call, epoll maintains that list in the kernel and provides (de)registration
functions for individual fds. This prevents the kernel from having to scan
potentially thousands of file descriptors for each call to discover only a
handful which had activity.

Oddly enough, the interface to the poll call in the python select module
much more closely resembles the design of epoll (kudos to whoever designed
that).

This code has undergone some testing with both codeville and BitTorrent, but
I'm not going to claim it's seen as much testing as it should.

The NeedForSpeed wiki lists /dev/epoll as a goal for the twisted folks. I
assume that the naming here is either confusion with the Solaris /dev/poll
or that it refers to the initial implementation of epoll, which I believe
used a device file. Either way, this would give them that support for free,
as well as everyone else.

Ross


More information about the Python-Dev mailing list