| advertise add site services publishers database health videos | ![]() | about toolbar stats live show health store more stuff JOIN/LOGIN |
This article is about the I/O method. For the vector addressing type, see Gather-scatter (vector addressing). 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:
The applicable functions readv[1] and writev[2] 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.[3] 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[4] for working efficiently that eliminate the problem. [edit] References |
| ↑ top of page ↑ | about thumbshots |