当前位置:网站首页>MMAP zero copy knowledge point notes
MMAP zero copy knowledge point notes
2022-07-02 04:50:00 【Chirp cat】
In the traditional way IO Send local files to the network
Co occurring 4 Second copy ,4 Context switching between subkernel state and user state .
call read() Method , The program sinks from user mode to kernel mode .
Copy the files in the disk to the kernel buffer (DMA copy).
Copy the data in the kernel buffer to the user buffer (CPU copy), The program changes from kernel mode to user mode ,read() Method returns .
call write() Method , The program sinks from user mode to kernel mode again , And copy the data in the user buffer to socket buffer (CPU copy).
take socket The data in the buffer is copied to the network card and sent (DMA copy), The program changes from kernel mode to user mode ,write() Method returns .
DMA: Direct memory access ( For sharing CPU The pressure of copying )
With mmap Send local files to the network
Co occurring 3 Second copy ,4 Context switching between subkernel state and user state .
call mmap() Method , The program sinks from user mode to kernel mode .
Copy the files in the disk to the kernel buffer (DMA copy).
The program changes from kernel mode to user mode ,mmap() Method returns . At the same time, the kernel buffer and user mode buffer establish a mapping relationship , Kernel buffer and user buffer realize memory sharing .
call write() Method , The program sinks from user mode to kernel mode again . And copy the data in the kernel buffer directly to socket buffer (CPU copy).
take socket The data in the buffer is copied to the network card and sent (DMA copy), The program changes from kernel mode to user mode ,write() Method returns .
边栏推荐
- Mysql表insert中文变?号的问题解决办法
- Introduction to Luogu 3 [circular structure] problem list solution
- Application of intelligent robot in agricultural ecology
- Leetcode- insert and sort the linked list
- June book news | 9 new books are listed, with a strong lineup and eyes closed!
- Let正版短信测压开源源码
- 数学知识——快速幂的理解及例题
- 2022-003arts: recursive routine of binary tree
- Thinkphp内核工单系统源码商业开源版 多用户+多客服+短信+邮件通知
- 关于Steam 教育的知识整理
猜你喜欢

Rhcsa --- work on the third day

VMware installation win10 reports an error: operating system not found

How to recover deleted data in disk

06 decorator mode

TypeScript函数详解

idea自动导包和自动删包设置

Analyzing the hands-on building tutorial in children's programming
![Learn AI safety monitoring project from zero [attach detailed code]](/img/a9/cb93f349229e86cbb05ad196ae9553.jpg)
Learn AI safety monitoring project from zero [attach detailed code]

记录一次Unity 2020.3.31f1的bug

社交媒体搜索引擎优化及其重要性
随机推荐
Embedded-c language-8-character pointer array / large program implementation
Virtual machine installation deepin system
C - derived classes and constructors
What data does the main account of Zhengda Meiou 4 pay attention to?
The solution to the complexity brought by lambda expression
Interview question: do you know the difference between deep copy and shallow copy? What is a reference copy?
面试会问的 Promise.all()
Typescript function details
Mouse events in JS
Introduction to Luogu 3 [circular structure] problem list solution
农业生态领域智能机器人的应用
初学爬虫-笔趣阁爬虫
二叉樹解題(二)
Markdown编辑语法
Mysql database learning
How to recover deleted data in disk
10 minute quick start UI automation ----- puppeter
Analyze the space occupied by the table according to segments, clusters and pages
Getting started with pytest ----- confitest Application of PY
Websites that it people often visit