当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
[penetration test tool sharing] [dnslog server building guidance]
693. 行程排序
网络IO总结文
无法获取下列许可SOLIDWORKS Standard,无法找到使用许可文件。(-1,359,2)。
3428. 放苹果
Include error in vs Code (new header file)
Bandwidth and currency
如何卸载--奇安信安全终端管理系统
如何在qsim查看软件对象的实例?
Oppo self-developed large-scale knowledge map and its application in digital intelligence engineering
Day5 - Flame restful request response and Sqlalchemy Foundation
Map structure
693. Travel sequencing
Fluent rendering mechanism - GPU thread rendering
低成本、低门槛、易部署,4800+万户中小企业数字化转型新选择
JS advanced knowledge - function
redis 网络IO
Flask request data acquisition and response
Creation and simple application of QPushButton button button
Background image related applications - full, adaptive









