Regular File I/O

Marc Lehmann schmorp at
Mon Sep 17 09:15:41 CEST 2012

On Mon, Sep 17, 2012 at 05:33:44AM -0000, Amit  Kumar <k_amitcool at> wrote:
> I am evaluating libev for regular File I/O (disk based files). Going through few emails on this mailing list and on basis of my understanding of Async I/O behaviour on Linux, I believe:

libev doesn't do any I/O at all, it only notifies of the availability. For
files, this is not very useful (but works, unlike most other event libs
using epoll), because the availability is always known to the kernel, so
asking the kernel just adds overhead.

> (a) True AIO is not supported for disk based regular files as underlying OS does not has support for it. Hence libev does not has support for it as it is essentially an event loop.

linux does support true aio, and so do posix systems implementing posix
aio. the reason it's not implemented in libev is that libev doesn't do

> (b) Posix AIO is not integrated with libev.

Right, it would make no sense.

> (c) libev does not use threads for even notifications on Linux (epoll, select are used).

What exactly do you mean with threads for event notification? Start a
thread for each event? That can be done trivially in a callback. Or do
you mean waking up threads instead of calling callbacks? Libev can be
configured to do that, too. Or do you mean gathering events from multiple
threads? That is supported as well.

> PS: I am very new to libev, so please forgive me if i am incorrect here.

If your goal is to do async I/O (for files and similar sources), you can
use libeio, which wraps most of the posix api for asynchronous use, and can
be integrated easily into libev.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list