Home > other >  Based on sendfile achieve zero copy of I/O general process??
Based on sendfile achieve zero copy of I/O general process??

Time:04-23

Based on sendfile achieve zero copy of I/O general process??

CodePudding user response:

Sendfile system call, result in user mode to kernel mode switch context (context switching) for the first time, through the DMA copies the contents of the disk file into a buffer in kernel space (the first copy: hard driver - & gt; The kernel buffer),
And then copy the data from the kernel space buffer in the kernel buffer associated with the socket (the second copy: the kernel buffer - & gt; The socket buffer),
Sendfile system call returns, leading to a kernel space to user space context switch (the second context switch, socket buffer by the DMA engine passes the kernel space of the data is passed to the protocol engine (the third copy: the socket buffer - & gt; Protocol engine),
By sendfile zero copy of I/O only use two user space and kernel space context switches, and 3 copies of data,
  • Related