This module implements asynchronous I/O using whatever means your operating
system supports. It is implemented as an interface to libeio
Asynchronous means that operations that can normally block your program (e.g.
reading from disk) will be done asynchronously: the operation will still block,
but you can do something else in the meantime. This is extremely useful for
programs that need to stay interactive even when doing heavy I/O (GUI programs,
high performance network servers etc.), but can also be used to easily do
operations in parallel that are normally done sequentially, e.g. stat'ing many
files, which is much faster on a RAID volume or over NFS when you do a number
of stat operations concurrently.
While most of this works on all types of file descriptors (for example
sockets), using these functions on file descriptors that support nonblocking
operation (again, sockets, pipes etc.) is very inefficient. Use an event loop
for that (such as the EV module): IO::AIO will naturally fit into such an event
In this version, a number of threads are started that execute your requests and
signal their completion. You don't need thread support in perl, and the threads
created by this module will not be visible to perl. In the future, this module
might make use of the native aio functions available on many operating systems.
However, they are often not well-supported or restricted (GNU/Linux doesn't
allow them on normal files currently, for example), and they would only support
aio_read and aio_write, so the remaining functionality would have to be
implemented using threads anyway.