Sendfile(2)是一种避免缓冲区复制开销的技术,并且它直接将数据位从文件系统转移到网络。
Sendfile (2) is a technique that avoids buffer copy overhead, and it directly pushes bits from the file system onto the network.
步骤二:数据从内核空间缓冲区复制到用户空间缓冲区,之后系统调用read返回,这导致了从内核空间向用户空间的上下文切换。
Step two: data is copied from the kernel buffer into the user buffer, and the read system call returns. The return from the call caused a context switch from kernel back to user mode.
步骤二:write系统调用导致内核将数据从内核缓冲区复制到与socket相关联的内核缓冲区中。
Step two: the write system call causes the kernel to copy the data from the original kernel buffers into the kernel buffers associated with sockets.
应用推荐