Advanced | Help | Encyclopedia
Directory


Vectored I/O

Vectored I/O, also known as scatter/gather I/O, is method of input and output by which a single procedure call sequentially writes data from, or reads data into, a vector of buffers, to or from, respectively, a data stream. Scatter/gather refers to the process of gathering data from, or scattering data into, the given set of buffers. The I/O can be performed synchronously or asynchronously.

There are several usages for vectored I/O:

  • efficiency: one vectored I/O read or write can replace many ordinary reads or writes;
  • splitting input: for example, when reading data that are in a format that defines a fixed-size header, one can use a vector of buffers in which the first buffer is the size of that header; and
  • atomicity: for example, if the particular vectored I/O implementation supports atomicity, a process can write from or read into a set of buffers to or from a file without risk that another thread or process might perform I/O on the same file between the first process' reads or writes, thereby corrupting the file or compromising the integrity of the input.

The second two usages can be accommodated without vectored I/O, but less efficiently, by splitting the data after reading them or catenating the data into a single buffer before writing them--i.e., performing the task of scattering or gathering oneself.

Procedures for vectored I/O, readv and writev, can be found in POSIX 1003.1–2001, 4.2BSD, 4.4BSD, and the Single UNIX Specification, version 2.








Links: Addme | Keyword Research | Paid Inclusion | Femail | Software | Completive Intelligence

Add URL | About Slider | FREE Slider Toolbar - Simply Amazing
Copyright © 2000-2008 Slider.com. All rights reserved.
Content is distributed under the GNU Free Documentation License.