Download the authoritative guide: Enterprise Data Storage 2018: Optimizing Your Storage Infrastructure
In my last article we covered the I/O path for the C library I/O and how applications use the C library data path to get to the operating system. This month we are going to cover the operating system and the associated systems calls for I/O.
Over my nearly 23 years in the computing industry some of the biggest mistakes I've seen have been when architects, system administrators and vendors made critical decisions to purchase, optimize and design without fully understand how the system all worked together. I strongly believe that you cannot purchase, optimize and design storage systems (hardware and software) without fully understanding the files sizes, number of files, access patterns, and, most importantly, the I/O request sizes that the hardware will see from the operating system and file system. So this month we will be looking at operating systems system calls and how they pass data to and from the file system.
I/O Path (Using POSIX System Calls)
Last month we discussed the I/O data path using the C library package. The next step in the data path is the operating system and POSIX system calls for performing I/O. We'll also take a look at some of the implications of various operating systems and, in some cases, the file system implementation. Almost all operating systems today are POSIX compliant.
We will also discuss the data path for system calls and the C library I/O when requests do not begin and end on 512-byte boundaries. The path for system calls and the path from the C library to the system is the same.
A large number of variables impact both the data path and the I/O and system performance when using system calls, but first we need to review some of the important system calls for I/O and how they are used. There are two types of I/O supported on most POSIX-compliant systems. They are:
- Synchronous I/O -- Each I/O request waits for the completion of the last request to that file descriptor before the next request is allowed to execute. With synchronous I/O, you will wait for the I/O request to complete before execution of the next instruction in the application.
- Asynchronous I/O (AIO) -- I/O requests are sent to the system and then the synchronization is requested by the application. With asynchronous I/O, the requests are issued to the operating system and the next instruction is immediately executed.
It should be noted that some applications that use POSIX threads implement asynchronous I/O via threads, but the I/O within each thread is synchronous.