当前位置:网站首页>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 .
边栏推荐
猜你喜欢

SAP ABAP data dictionary tutorial se11: tables, locked objects, views, and structures-03

机器学习笔记 - HaGRID—手势识别图像数据集简介

SAP ABAP data types, operators and editors-02

SAP script tutorial: se71, se78, SCC1, vf03, so10-013

Machine learning notes - Hagrid - Introduction to gesture recognition image data set

让pycharm项目里面的文本模板支持jinjia2语法

Linux安装mysql

数值类型和字符串之间的转换

wallys/WiFi6 MiniPCIe Module 2T2R 2×2.4GHz 2x5GHz

Lecture 6 of slam Lecture 14 -- nonlinear optimization
随机推荐
【C语言】深度剖析整型和浮点型在内存中的存储
sql语法检测
Implementation classes with similar execution logic use the template pattern
CUMT study diary - quick notes of digital image processing examination
Deploy odoo to the server and configure it as a service
论催收系统的任务调度设计
odoo系统对原有模型单独开发的视图设置优先级
Focus on creating a net red product. The xinjietu x70s is newly launched, starting from 87900
CMake教程系列-00-简介
3. Classe abstraite (forme)
SAP abap 数据类型,操作符和编辑器-02
Program substitution function
SAP ABAP 数据字典教程 SE11:表、锁定对象、视图和结构 -03
使用stream api替代sql
6.GUI(图形,填充)
6.gui (graphics, filling)
[Shanda conference] project introduces Redux
Default function control =default and =delete
uniapp微信小程序获取页面二维码(带有参数)
长安链使用技巧总结