当前位置:网站首页>Network IO summary
Network IO summary
2022-07-27 08:42:00 【Mangxiao】
The Internet IO Summing up,
IO
I/O Preface —— Five kinds IO Communication model
I/O Preface —— Five kinds IO Communication model
Multiplexing IO Model
I/O Multiplexing model select
I/O Multiplexing model poll
I/O Multiplexing epoll
Linux Realization
Linux I/O Multiplexing epoll
understand linux epoll Implementation principle of
BIO
BIO Example
BIO Realization

1. perform ServerSocket Constructors
ServerSocket Constructor source code analysis
2. BIO ServerSocket.accept() Wait for client request
BIO ServerSocket.accept() Wait for client request
BIO Components
ServerSocket
Socket
SocksSocketetImpl
windows Platform components
PlainSocketImpl
DualStackPlainSocketImpl
DualStackPlainSocketImpl Various encapsulation of local methods
InetSocketAddress
InetSocketAddress Encapsulate socket information (IP+ port )
NIO
NIO Summing up, —— Read and understand NIO The whole process
NIO Summing up, —— Read and understand NIO The whole process
NIO Example
NIO The working process of the server

1. NIO Server preparation
2. this.selector.select() Find the coming events of interest
3. Interested events come
NIO select() >0—— Handle incoming events !
Components
SelectorProvider
SelectorProviderImpl
Selector
Channel
SocketChannelImpl
SelectionKey
NIO Components Selector And SelectionKey 、 SelectionKeyImpl
Pipe
Net
NIO client ( rough )
NIO Client creation Channel
NIO Client initiates connection
NIO Details of interaction between client and server
reflection
from BIO To NIO、 Until then Netty
from BIO To NIO、 Until then Netty
Sort out the knowledge points
NIO
Thread relationship
Above NIO Example , There is only one main Threads do not create additional threads , in other words Selector、Channel Processing in the same thread , adopt Selector To achieve polling NIO It has the following characteristics :
- Single thread handles multi-channel communication
- select Methods block ( Make the process Channel Events in are realized by synchronization )
This classic NIO The way and BIO The biggest significance of comparison is to change connection oriented processing to event oriented processing .
Selector、Channel Processing in the same thread still has optimization space , That is to say Selector Add multithreading based on , Multithreading and BIO Multithreading has a different meaning , The use of additional threads will be more effective .
Channel The meaning of
stay BIO In the implementation , Flow and Socket Direct connection , You can understand it as :
One side of a faucet is the water source ( client ), The other side is a person ( Server side ), This person wants to drink water , But no utensils , So I can only wait under the tap for the unknown water supply , Even if there is no water , People still have to wait , Because it must be able to receive water .
BIO That's it ,BIO Non blocking can be realized , however BIO The biggest problem is that the flow is directly related to Socket signal communication .
We analyzed NIO Is block programming , In fact, that is BIO Add cache implementation on the basis of
expand
NIO Buffer
TODO
边栏推荐
- How to merge multiple columns in an excel table into one column
- Login to homepage function implementation
- I drew a Gu ailing with characters!
- Functions and arrow functions
- Transaction, order system add transaction
- Block, there is a gap between the block elements in the row
- List删除集合元素
- JWT authentication and login function implementation, exit login
- 4275. Dijkstra sequence
- Sliding conflict of view
猜你喜欢

说透缓存一致性与内存屏障

The shelf life you filled in has been less than 10 days until now, and it is not allowed to publish. If the actual shelf life is more than 10 days, please truthfully fill in the production date and pu

海关总署:这类产品暂停进口

Installation and use of beef XSS

Massive data Xiao Feng: jointly build and govern opengauss root community and share a thriving new ecosystem

众昂矿业:新能源行业快速发展,氟化工产品势头强劲

4276. Good at C

Oppo self-developed large-scale knowledge map and its application in digital intelligence engineering

Functions and arrow functions

Fluent rendering mechanism - GPU thread rendering
随机推荐
NIO示例
Massive data Xiao Feng: jointly build and govern opengauss root community and share a thriving new ecosystem
Pass parameters and returned responses of flask
Flutter 渲染机制——GPU线程渲染
View 的滑动冲突
无法获取下列许可SOLIDWORKS Standard,无法找到使用许可文件。(-1,359,2)。
Unity3D 2021软件安装包下载及安装教程
3311. Longest arithmetic
JS检测客户端软件是否安装
Process control - Branch
First experience of tryme in opengauss
Flask one to many database creation, basic addition, deletion, modification and query
Node installation and debugging
arguments
Login to homepage function implementation
4275. Dijkstra sequence
Arm system call exception assembly
What are the differences or similarities between "demand fulfillment to settlement" and "purchase to payment"?
How to permanently set source
Flink1.15源码阅读flink-clients客户端执行流程(阅读较枯燥)