What in Java BIO, NIO, AIO are

BIO: synchronous and blocking, server model to achieve a connection to a thread that has a client connection request on the server side need to start a thread for processing, if the connection does not do anything to cause unnecessary overhead of thread, of course, can improved thread pooling mechanism. The number of connected mode applies to relatively small BIO and fixed architecture, server resources in this way is relatively high, limited concurrent applications, the JDK1.4 previously only option, but the program intuitive and easy to understand.
NIO: synchronous non-blocking, the server requests a mode of realization of a thread, i.e. the connection request sent by the client are registered to the multiplexer, the multiplexer is connected to the polling I / O request when a start thread for processing. NIO connection number suitable for multi-mode and connected to short (light operation) architecture, such as chat server, limited concurrent applications, more complex programming, starts the JDK1.4 support.
AIO: asynchronous nonblocking server mode is a valid request to achieve a thread, the client I / O requests are completed by the OS to the notification server and then to start the application process .AIO threads to the number of connected mode using a multi-connector and a relatively long (re-operation) architecture, such as the album server, call the OS to fully participate in concurrent operation, programming is more complex, JDK7 began to support.


The difference between the IO and NIO
a .IO stream oriented, NIO buffer is oriented.
Two .IO various streams are blocked, NIO are nonblocking.
Three .Java NIO selector allows a single thread to monitor multiple input channels, you can register multiple channels using a selector, and then use a separate thread to "select" Channel: these passages may have been processed input, or selected channel is ready to be written. This selection mechanism, such that a single thread is easy to manage a plurality of channels.

Reproduced in: https: //www.cnblogs.com/fanblogs/p/11039224.html

Guess you like

Origin blog.csdn.net/weixin_34102807/article/details/93281155