当前位置:网站首页>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 .
边栏推荐
- geotrust ov多域名ssl证书一年两千一百元包含几个域名?
- Flag bits in assembly language: CF, PF, AF, ZF, SF, TF, if, DF, of
- How to write a client-side technical solution
- LeetCode-归并排序链表
- Getting started with pytest ----- confitest Application of PY
- How to recover deleted data in disk
- 2022-003arts: recursive routine of binary tree
- TypeScript函数详解
- Learn BeanShell before you dare to say you know JMeter
- Federal learning: dividing non IID samples according to Dirichlet distribution
猜你喜欢
The core idea of performance optimization, dry goods sharing
记录一次Unity 2020.3.31f1的bug
Precipitate yourself and stay up late to sort out 100 knowledge points of interface testing professional literacy
Ten thousand volumes are known to all, and one page of a book is always relevant. TVP reading club will take you through the reading puzzle!
ansible安装与使用
Its appearance makes competitors tremble. Interpretation of Sony vision-s 02 products
洛谷入门3【循环结构】题单题解
奠定少儿编程成为基础学科的原理
解析少儿编程中的动手搭建教程
Summary of main account information of zhengdaliu 4
随机推荐
Exposure X8标准版图片后期滤镜PS、LR等软件的插件
農業生態領域智能機器人的應用
Interview question: do you know the difference between deep copy and shallow copy? What is a reference copy?
洛谷入门3【循环结构】题单题解
js面试收藏试题1
Starting from the classification of database, I understand the map database
Pytoch yolov5 runs bug solution from 0:
C language practice - number guessing game
geotrust ov多域名ssl證書一年兩千一百元包含幾個域名?
DJB Hash
记录一次Unity 2020.3.31f1的bug
培养中小学生对教育机器人的热爱之心
AcrelEMS高速公路微电网能效管理平台与智能照明解决方案智慧点亮隧道
Cache consistency solution - how to ensure the consistency between the cache and the data in the database when changing data
win10 磁盘管理 压缩卷 无法启动问题
06 装饰(Decorator)模式
geotrust ov多域名ssl证书一年两千一百元包含几个域名?
DMA Porter
Landing guide for "prohibit using select * as query field list"
Unit testing classic three questions: what, why, and how?