当前位置:网站首页>5 modes of IO model
5 modes of IO model
2022-06-22 16:29:00 【The force is with you】
Differentiation and analysis
Reference resources :unix Network programming
Preface :
stay LInux Under the system , User space and kernel space can be switched to each other
Blocking IO
Blocking IO: Switch from user space to kernel space , Kernel space is waiting for data to arrive , When the data arrives, it is copied from the network card to the memory , After copying, switch from kernel space to user space , Read . During this process, the user thread has been blocked .( Handling one event cannot handle other events )
Synchronous blocking
Non blocking IO
Non blocking IO: Wait until the data is not blocked , Data is also blocked when it reaches the replication phase .
Synchronous nonblocking
Multiplexing
selector, Stop it first , If something happens, it won't be blocked ;read Also block . It saves time waiting for events .
The essence is also synchronization
Signal driven
asynchronous IO
Threads 1 launch ( Specify the callback method ) -----> Threads 2 To get the results ( After the result comes out, it passes through the thread 1 Method return )
Asynchronism is non blocking .
Sync : The thread initiates the action itself , Get the results yourself .
asynchronous : Thread initiated action , Other threads get results .
Read file write socket flow

java Use direct memory , There is no need to copy between the user buffer and the kernel buffer , in total 3 Time , save 1 Time .
Optimize
linux2.1 Provided sendFile Method ,java Corresponding channel Of transferTo and transFrom Method copy
linux2.4 java Called transferTo After the method , from java From user mode to kernel mode , Use DMA Read data into kernel buffer , Can't use cpu,
Only the user mode and kernel mode are switched , Data from disk to kernel buffer , From the kernel buffer to the network card ,0 Copying is not done java Of memory , Will not occupy cpu Time .DMP Will liberate cpu Time .
0 Copy is suitable for small file transfer .
边栏推荐
- Lecture 6 of slam Lecture 14 -- nonlinear optimization
- SAP script tutorial: se71, se78, SCC1, vf03, so10-013
- ALV report in SAP tutorial - ABAP list viewer -012
- NiO uses writable events to handle the situation of one-time write incompleteness
- 全球首款AR隐形眼镜,元宇宙入口这次真的打开了?
- What is the relationship between CSC securities and qiniu school? Is it safe to open a securities account
- nio服务多线程版本
- 买网红雪糕的我,成了大冤种
- Make the text template in pycharm project support jinjia2 syntax
- 【小程序项目开发-- 京东商城】uni-app开发之配置tabBar & 窗口样式
猜你喜欢

静态断言 static_assert

数睿数据受邀参与南通企业数字化转型研讨会

SAP ABAP dialog programming tutorial: module pool in -09

Runtime -- explore the nature of classes, objects, and classifications

SAP web service cannot log in to SOA management page with soamanager

odoo系统对原有模型单独开发的视图设置优先级

User exit and customer exit in SAP ABAP -015

C语言贪吃蛇

如何为政企移动办公加上一道“安全锁”?

在JFlash中添加未知类型的单片机
随机推荐
[Shanda conference] private chat channel webrtc tools
SAP ABAP 中 OpenSQL和Native SQL-05 本教程的目的不是教您 SQL 或数据库概念
数睿数据荣获第二届ISIG中国产业智能大会两项年度大奖
数睿数据深度 | 关于软件自主可控,源代码向左,无代码向右
3. abstract class (shape)
odoo部署到服务器并配置为服务
uniapp微信小程序获取页面二维码(带有参数)
SAP abap 数据类型,操作符和编辑器-02
天翼云乘风新基建,构建数字化转型“4+2”能力体系
SLAM十四讲之第6讲--非线性优化
ALV report in SAP tutorial - ABAP list viewer -012
SAP ABAP 中的 Smart Forms-014
Implementation classes with similar execution logic use the template pattern
安全信得过!天翼云数据安全管理平台通过评测
nio文件和文件夹操作例子
SAP ABAP data dictionary tutorial se11: tables, locked objects, views, and structures-03
北京恢复堂食半月记:如何重燃门店经营烟火气
长安链使用技巧总结
Conversion between numeric types and strings
19、 Xv6 context switching (implementation of context switching; encapsulation and recovery of state machine)