Normally sending a file over a socket copies data from disk to the kernel page cache, to a user buffer, back to a kernel socket buffer, then to the network card.
Zero-copy calls such as sendfile (and mmap) let the kernel move data directly between buffers (or use DMA), skipping user-space copies, which saves CPU and memory bandwidth for static file servers and data pipelines.
Loading…