rn - readiness notification

rn - readiness notification

rn - readiness notification

Contents

The Problem: Efficient I/O multiplexing calls not yet standardized

Unix offers two system calls, select() and poll(), which accept a list of file descriptors, block until one of the set is ready for I/O, and return a list of the ready file descriptors. The time to execute these calls is proportional to the number of file descriptors, which means they become inefficient above a couple thousand file descriptors.

Various implementations of Unix offer high-performance, scalable replacements for these system calls, e.g. kqueue(), /dev/epoll, and Linux's realtime signal readiness notification, all with significantly different interfaces. This makes them difficult to learn, and makes it hard to write portable code.

(See The C10K Problem for more about the problem.)

One Solution: a Thin Wrapper around epoll et al

rn is a tiny lightweight library written in C, licensed under the LGPL, that provides a common abstraction for several readiness notification schemes. It is significantly easier to use then sigio, and about as easy to use as kqueue, epoll, and the edge-triggered variant of sys_epoll.

New readiness notification schemes can easily be supported by writing a new "subclass" of rn.

It currently only supports edge-triggered readiness notification schemes. It could easily be used with level-triggered schemes, but IMHO edge-triggered readiness notification is more convenient when you get used to it, and has slightly less CPU overhead.

Downloading rn

Installing rn

To install rn, do the usual
$ tar -xzvf rn-0.4.tar.gz
$ cd rn-0.4
$ ./configure
$ make
$ su
# make install
This will install rn.h and librn.a.

Using rn

The api is fairly simple; see rn.html for documentation, and rn_test.c for an example.

 


Last change: 15 Oct 2003
Portions Copyright 2002 Dan Kegel
Portions Copyright 2003 Ixia Communications
Licensed under the LGPL
[Return to kegel.com]

你可能感兴趣的:(notification)