A Solution: Asynchronous I/O

Let's try to address the issue of blocking calls in event-based applications in this lesson.

We'll cover the following

To overcome the issue of blocking calls discussed in the last lesson, many modern operating systems have introduced new ways to issue I/O requests to the disk system, referred to generically as asynchronous I/O. These interfaces enable an application to issue an I/O request and return control immediately to the caller before the I/O has completed; additional interfaces enable an application to determine whether various I/Os have completed.

An example: Mac’s API

For example, let us examine the interface provided on a Mac (other systems have similar APIs). The APIs revolve around a basic structure, the struct aiocb, or AIO control block in common terminology. A simplified version of the structure looks like this (see the manual pages for more information):

Get hands-on with 1200+ tech skills courses.