Vectored I/O

Vectored I/O

Vectored I/O, also known as scatter/gather I/O, is a method of input and output by which a single procedure call sequentially writes data from multiple buffers to a single data stream or reads data from a data stream to multiple buffers. The buffers are given in a vector of buffers. "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. The main reasons for using vectored I/O are efficiency and convenience.

There are several usages for vectored I/O:

*Atomicity: 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;
*Concatenating output: An application that wants to write non-sequentially placed data in memory can do so in one vectored I/O operation. For example, writing a fixed-size header and its associated payload data that are placed non-sequentially in memory can be done by a single vectored I/O operation without first concatenating the header and the payload to another buffer;
*Efficiency: One vectored I/O read or write can replace many ordinary reads or writes, and thus save on the overhead involved in syscalls;
*Splitting input: When reading data that is 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 the second buffer will contain the data associated with the header.

The applicable functions readv [ [http://www.opengroup.org/onlinepubs/009695399/functions/readv.html readv] in the Single Unix Specification] and writev [ [http://www.opengroup.org/onlinepubs/009695399/functions/writev.html writev] in the Single Unix Specification] can be found in POSIX 1003.1-2001 and the Single UNIX Specification version 2. The Windows API has analogous functions ReadFileScatter and WriteFileGather; however unlike the POSIX functions they require each buffer to be aligned on a memory page. [ [http://msdn2.microsoft.com/en-us/library/aa365469.aspx ReadFileScatter] in MSDN Library] Windows Sockets provide separate WSASend and WSARecv functions without this requirement.

While working directly with a vector of buffers can be significantly harder than working with a single buffer, there are often higher level APIs [ [http://www.and.org/vstr/ Vstr] the Vectored String API] for working efficiently that eliminate the problem.

References


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Vectored Exception Handling — Microsoft Vectored Exception Handling (VEH) is an exception handling mechanism that complements the Structured Exception Handling mechanism. It is available on the Windows NT family of operating systems, starting with Windows XP. It was extended… …   Wikipedia

  • vectored-thrust engine — An engine in which the direction of the thrust can be varied. In VTOL/VSTOL (vertical takeoff and landing/vertical short takeoff and landing) aircraft using vectored thrust engines, the thrust can be varied from vertical to horizontal, and vice… …   Aviation dictionary

  • vectored attack — Attack in which a weapon carrier (air, surface, or subsurface) not holding contact on the target is vectored to the weapon delivery point by a unit (air, surface, or subsurface) which holds contact on the target …   Military dictionary

  • vectored attack — koreguojamoji ataka statusas T sritis Gynyba apibrėžtis Ataka, kurios metu ginklą nešančioji priemonė (oro, sausumos ar povandeninė), neturinti sąlyčio su taikiniu, yra nukreipiama į taikinį padaliniu (oro, sausumos ar povandeniniu), esančiu… …   NATO terminų aiškinamasis žodynas

  • vectored — adj. of a vector, of a mathematical representation of a quantity that has both magnitude and direction …   English contemporary dictionary

  • vectored — …   Useful english dictionary

  • Vectored Thrust — thrust force (in airplanes) that allows one to change the direction using different devices and therefore control the direction of the airplane …   English contemporary dictionary

  • vectored thrust — /vɛktəd ˈθrʌst/ (say vektuhd thrust) noun a method of jet propulsion efflux of which can be directed downward or forward to obtain VTOL or STOL performance …  

  • List of VTOL aircraft — This is a list of planes capable of vertical take off and landing arranged under manufacturer. The list excludes helicopters because they are assumed to have this capability. A * Aero Design Development Hummingbird * Armadillo Aerospace Quad *… …   Wikipedia

  • Thrust vectoring — Infobox Aviation name = Thrust vectoring caption = The F 18 HARV, X 31, and F 16 MATV in flightThrust vectoring is the ability of an aircraft or other vehicle to direct the thrust from its main engine(s) in a direction other than parallel to the… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”