Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Vectored I/O
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Input/output method in computing}} {{About|the I/O method|the vector addressing type|gather/scatter (vector addressing)}} In [[computing]], '''vectored I/O''', also known as '''scatter/gather I/O''', is a method of [[Input/output|input and output]] by which a single procedure call sequentially reads data from multiple [[data buffer|buffers]] and writes it to a single [[data stream]] (gather), or reads data from a data stream and writes it to multiple buffers (scatter), as defined in a [[vector (data structure)|vector]] of buffers. ''Scatter/gather'' refers to the process of gathering data from, or scattering data into, the given set of buffers. Vectored I/O can operate synchronously or asynchronously. The main reasons for using vectored I/O are efficiency and convenience. Vectored I/O has several potential uses: * [[Atomicity (programming)|Atomicity]]: if the particular vectored I/O implementation supports atomicity, a process can write into or read from a set of buffers to or from a file without risk that another [[Thread (computer science)|thread]] or [[Computer process|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 [[syscall]]s * Splitting input: when reading data held 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 Standards bodies document the applicable functions <code>readv</code><ref>[http://www.opengroup.org/onlinepubs/009695399/functions/readv.html readv] {{Webarchive|url=https://web.archive.org/web/20080905083604/http://www.opengroup.org/onlinepubs/009695399/functions/readv.html |date=2008-09-05 }} in the Single Unix Specification</ref> and <code>writev</code><ref>[http://www.opengroup.org/onlinepubs/009695399/functions/writev.html writev] {{Webarchive|url=https://web.archive.org/web/20071217075647/http://www.opengroup.org/onlinepubs/009695399/functions/writev.html |date=2007-12-17 }} in the Single Unix Specification</ref> in [[POSIX]] 1003.1-2001 and the [[Single UNIX Specification]] version 2. The [[Windows API]] has analogous functions <code>ReadFileScatter</code> and <code>WriteFileGather</code>; however, unlike the POSIX functions, they require the alignment of each buffer on a [[memory page]].<ref>[http://msdn2.microsoft.com/en-us/library/aa365469.aspx ReadFileScatter] in MSDN Library</ref> [[Winsock]] provides separate <code>WSASend</code> and <code>WSARecv</code> functions without this requirement. While working directly with a vector of buffers can be significantly harder than working with a single buffer, using higher-level APIs<ref>[http://www.and.org/vstr/ Vstr] {{Webarchive|url=https://web.archive.org/web/20170305020810/http://www.and.org/vstr/ |date=2017-03-05 }} the Vectored String API</ref> for working efficiently can mitigate the difficulties.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)