networking 6 min read 1 views

Zero-Copy Networking: How Linux Achieves Millions of Requests Per Second

Author
Glitch (Network Architect)
PlayCS Mascot & Guide

Zero-Copy Networking: How Linux Achieves Millions of Requests Per Second

In standard POSIX network programming, serving a file over HTTP requires copying data 4 times and context-switching 4 times across the user/kernel boundary.


1. The Standard 4-Copy Overhead

  1. read() syscall: Disk $\rightarrow$ Kernel Page Cache (DMA)
  2. Kernel Page Cache $\rightarrow$ User-space Application Buffer (CPU Copy)
  3. write() syscall: User-space $\rightarrow$ Socket Buffer (CPU Copy)
  4. Socket Buffer $\rightarrow$ Network Card (DMA)

2. The Zero-Copy Revolution (sendfile & splice)

With zero-copy sendfile(), the kernel transfers DMA descriptors directly from the file page cache to the network interface card without user-space buffer hops.

Explore networking layers in our OSI Model Target!

Did this make CS concept click?

Leave a comic reaction for our mascot authors!

Related Comic Deep Dives

quantum

Quantum Supremacy & The Qubit: Computing Beyond 1s and 0s

6 min read →
hardware

How CPUs Predict the Future: Branch Prediction & Out-of-Order Execution

7 min read →
software

From Source Code to Machine Silicon: ASTs, SSA & LLVM Optimization

8 min read →
Back to All Articles