Scatter/Gather I/O
Scatter/Gather I/O
Scatter/Gather I/O
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 4<br />
CHAPTER 4<br />
Advanced File I/O<br />
In Chapter 2, we looked at the basic I/O system calls in Linux. These calls form not<br />
only the basis of file I/O, but also the foundation of virtually all communication on<br />
Linux. In Chapter 3, we looked at how user-space buffering is often needed on top of<br />
the basic I/O system calls, and we studied a specific user-space buffering solution,<br />
C’s standard I/O library. In this chapter, we’ll look at the more advanced I/O system<br />
calls that Linux provides:<br />
<strong>Scatter</strong>/gather I/O<br />
Allows a single call to read or write data to and from many buffers at once; useful<br />
for bunching together fields of different data structures to form one I/O<br />
transaction.<br />
Epoll<br />
Improves on the poll( ) and select( ) system calls described in Chapter 2; useful<br />
when hundreds of file descriptors have to be polled in a single program.<br />
Memory-mapped I/O<br />
Maps a file into memory, allowing file I/O to occur via simple memory manipulation;<br />
useful for certain patterns of I/O.<br />
File advice<br />
Allows a process to provide hints to the kernel on its usage scenarios; can result<br />
in improved I/O performance.<br />
Asynchronous I/O<br />
Allows a process to issue I/O requests without waiting for them to complete;<br />
useful for juggling heavy I/O workloads without the use of threads.<br />
The chapter will conclude with a discussion of performance considerations and the<br />
kernel’s I/O subsystems.<br />
83