On Mon, May 23, 2011 at 08:01:30AM -0400, Aaron Boxer <[email protected]> wrote:
> Pardon my confusion, I haven't done much IO on unix:
> 
> What are the tradeoffs for using  libev versus libeio?

There are none, they make completely different things and complement each
other.

> Would libev be appropriate for NAS file reads?

libev doesn't do any I/O for you. it basically tells you when data is
available, which makes most sense for network sockets or other event sources.

libeio does the I/O for you, but it's not very efficient to do network I/O
with it, because there you cna use events. it is useful to do file I/O or
in general file operations, such as stat, open, unlink, pread, pwrite...

> You mentioned that files must be opened in non-blocking mode;
> is there a disadvantage with this approach?

file descriptors for files react the same in non-blocking vs. blocking
mode - "blocking file descriptors" just means that the kernel will wait
until it knows the (normal) result of the read or write. for file I/O, the
kernel does know that without having the data yet, and some programs have
issues with waiting for the disk.

> I would be happy to simply use libev here.

The problem I see is that, if you don't have enough experience with file
I/O on unix, then you will have a lot to catch up, something we can't do
here, but something that would require a book or so. and experience.

as a rule of thumb, use libeio for files, and libev for other file
descriptors (sockets etc.).

keep in mind that unix has this "everything is a file" approach, which
boils down to most everything being a file descriptor. on windows and
many other operating systems, you need special functions to "read" data
from sockets, pipes, serial ports, files and so on, while on unix "read"
usually suffices for all these. however, they still do behave differently.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      [email protected]
      -=====/_/_//_/\_,_/ /_/\_\

_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to