rn - readiness notification

本文介绍了一种针对高效I/O复用调用未标准化的问题的解决方案:rn-readinessnotification。该方案通过C语言实现了一个轻量级库,提供统一抽象层以支持多种就绪通知机制,如epoll等,并简化了使用复杂接口的难度。

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]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值