All notes
Async

# Asynchronous programming

Good references:

• Async programming vs Multi-threaded programming, handout by Brown University.

About select, poll, epoll:

About libAIO:

select/poll also relies on kernel notification for ready filedeskriptors. But the disadvantage of select/poll is that they block as soon they are called because the Systemcall-Handler runs in the Kernel-Space.

Real asynchronous I/O is achieved via LibAIO (on Linux) and IOCP on Windows. As far as i know they dont block the calling process/thread in der User Space and they allow real overlapped I/O.

That means asynchronous Non Blocking I/O (LibAIO & IOCP) is faster, because it does not block the calling Thread and they allow real overlapped I/O. Select/poll are also asynchronous, but they are Asynchronous Blocking. And btw select and poll suffer from other specific problems so that they cant scale that well.

You don't mix epoll with io_submit; they are two completely different methods for doing IO. The former is for use with bsd style non blocking IO, and the latter is truly async io. epoll will signal you whenever a file can be read ( the read ahead buffer is non empty ) or written ( there's memory available to buffer writes ). io_getevents() won't notify you of anything until you actually request a read or write, in which case, it lets you know when that has completed.

The two systems are completely non interchangeable. With the former you wait first, then request some IO, which completes immediately. With the latter, you request some IO ( possibly many ), then wait for some to finish.