当前位置:网站首页>Understanding the IO model
Understanding the IO model
2022-06-28 09:03:00 【Know what you know】
BIO
Synchronize and block ( Traditional obstructive type ), The server implements a pattern of one thread per connection , That is, when the client has a connection request, the server needs to start a thread for processing , If the connection does nothing, it will cause unnecessary thread overhead .

NIO
Synchronous nonblocking , The server implementation mode deals with multiple requests for one thread ( Connect ), That is, the connection request sent by the client will be registered on the multiplexer , Multiplexer polled for I/O The request will be processed .

Selector
Selector The multiplexer is right linux Under the select/poll/epoll encapsulate ,selector There can be multiple implementations ,linux By default, the system uses epoll How to implement .
- Java Of NIO Non blocking I/O The way . You can handle several client connections with one thread , Will be used to Selector( Selectors ).
- Selector It can detect whether events occur on multiple registration channels ( Multiple Channel Register to the same as an event selector), If something happens , Then we get the events and deal with them accordingly .
- Only when there is a real read-write event in the connection , To read and write , Reduced system overhead , And you don't have to create a thread for each connection , No need to maintain multiple threads .
- Avoid the overhead caused by context switching between multiple threads .
AIO
Asynchronous non-blocking ,AIO The concept of asynchronous channel is introduced , Adopted Proactor Pattern , Simplified programming , Valid request to start thread , Its characteristic is to inform the server program to start the thread to process after the operating system completes , Generally, it is suitable for applications with more connections and longer connection time .
边栏推荐
猜你喜欢

Discussion on the practice of fire emergency lighting system in the field of building electrical design

Expérience d'optimisation SQL: de 30248 secondes à 0001 secondes

How to solve the problem of high concurrency and seckill

redis5.0的槽点迁移,随意玩(单机迁移集群)

Construire le premier réseau neuronal avec pytorch et optimiser

从知识到智慧:知识图谱还要走多远?

基于宽表的数据建模

与普通探头相比,差分探头有哪些优点

学习阿里如何进行数据指标体系的治理

数据挖掘建模实战
随机推荐
It only takes two steps to find the right PMP organization, one check and two questions
Implementation of single sign on
How do people over 40 allocate annuity insurance? Which product is more suitable?
How do individuals open accounts to speculate in stocks? Is online account opening safe?
Discussion on the practice of fire emergency lighting system in the field of building electrical design
How do I open an account on my mobile phone? Is it safe to open an account online now?
买卖股票费用计算
使用transform:scale之后导致页面鼠标悬浮事件消失
Avframe Memory Management API
Chrome devtools
Implement global double finger long press to return to the desktop
Key points of building fire protection design
【无标题】
APICloud携手三六零天御,助力企业守好App安全“第一关”
[untitled]
Expérience d'optimisation SQL: de 30248 secondes à 0001 secondes
How to suppress SiC MOSFET crosstalk?
Common tools for interface testing --postman
Copy & Deepcopy
Not so Mobile