- Operating System Support
- The Basic API
- The AIO Control Block
- Asynchronous Completion
- List I/O
- Limitations of AIO
Limitations of AIO
Asynchronous I/O operations take up some space in the kernel while they complete. As such, they tend to be rationed. On OS X, for example, you’re limited to 90 AIO operations in total at any one time, and only 16 per process. Unfortunately, the specification doesn’t define a standard way of finding these limits. Since AIO_LISTIO_MAX defines the maximum number of AIO operations that can be dispatched with a single system call, a good rule is to take this as the maximum number of AIO operations per process; with this precept, you’re guaranteed to choose a limit less than or equal to the real limit.
In some cases, it’s possible to increase the limits; for example, by changing sysctl values. Be careful doing this, however; often, those values are set low for a reason, and increasing them too much can make your kernel perform unexpectedly.
AIO support is still a little rough around the edges in a number of operating systems, and not supported in others. Any program or library that uses it should also provide a synchronous code path for platforms where a full AIO implementation is not available.
AIO is not suitable for all situations, but when used judiciously it can provide a significant speed benefit.