- Zero-copy
"Zero-copy" describes computer operations in which the CPU does not perform the task of copying data from one memory area to another.
Zero-copy versions of
operating system elements such asdevice driver s,file system s, andnetwork protocol stack s greatly increase the performance of certain application programs and more efficiently utilize system resources. Performance is enhanced by allowing the CPU to move on to other tasks while data copies proceed in parallel in another part of the machine. Also, zero-copy operations reduce the number of time-consuming context switches between user space and kernel space. System resources are utilized more efficiently since using a sophisticated CPU to perform extensive copy operations, which is a relatively simple task, is wasteful if other simpler system components can do the copying.Techniques for creating zero-copy software include the use of DMA-based copying and memory-mapping through an MMU. These features require specific hardware support and usually involve particular memory alignment requirements.
Zero-copy protocols are especially important for high-speed networks in which the capacity of a network link approaches or exceeds the CPU's processing capacity. In such a case the CPU spends nearly all of its time copying transferred data, gets little else done, and becomes a bottleneck which limits the communication rate to below the link's capacity. A rule of thumb used in the industry is that roughly one CPU clock cycle is needed to process one bit of incoming data. For example, a 1 GHz processor can handle a 1 Gbit/s network link with conventional data copying, but that same processor will be overwhelmed by a 10 Gbit/s link, and zero-copy software becomes necessary. Network links over 1 Gbit/s, and therefore zero-copy networking software, currently have limited applications in supercomputing clusters, large commercial data centers, and so on. However, as information technology improves, and as 1 Gbit/s, 10 Gbit/s, and even 100 Gbit/s networks become more common, zero-copy solutions are likely to also become more common, since network capacity is increasing faster than CPU capacity.
Zero-copy protocols have some initial overhead, so avoiding programmed IO (PIO) makes sense only for large messages.
RDMA (Remote Direct Memory Access) protocols deeply rely on zero-copy techniques.Several operating systems, including Linux, support zero copying of files through specific API's such as sendfile and sendfile64.
ee also
*
Embedded system
*Direct Memory Access
*Auto-sequencing memory (ASM)
*Device driver s
*Socket Direct Protocol
*Infiniband External links
* [http://www.ibm.com/developerworks/library/j-zerocopy/index.html Efficient data transfer through zero copy] by Sathish K. Palaniappan and Pramod B. Nagaraja
Wikimedia Foundation. 2010.