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. This is frequently used to save CPU cycles and memory bandwidth when transmitting a file over a network.
Programmatic access
Several operating systems support zero-copying of files through specific APIs.
The Linux kernel supports zero-copy through various system calls, such as:
Some of them are specified in POSIX and thus also present in the BSD kernels or IBM AIX, some are unique to the Linux kernel API.
FreeBSD, NetBSD, OpenBSD, DragonFly BSD, etc. support zero-copy through at least these system calls:
- sendfile
- write, writev + mmap when writing data to a network socket.
MacOS should support zero-copy through the FreeBSD portion of the kernel because it offers the same system calls (and its manual pages are still tagged BSD) such as:
- sendfile
Oracle Solaris supports zero-copy through at least these system calls:
- sendfile
- sendfilev
- write, writev + mmap
Microsoft Windows supports zero-copy through at least this system call:
- TransmitFile
Java input streams can support zero-copy through the java.nio.channels.FileChannel's transferTo() method if the underlying operating system also supports zero copy
RDMA (Remote Direct Memory Access) protocols deeply rely on zero-copy techniques.