One, look at the picture
A lot of IO data on the Internet, for beginners, the more look more dizzy. According to their own understanding, summed up the comparison of bio, NIO, AIO.
BIO: The thread initiates an IO request, and the thread blocks until the operation completes, regardless of whether the kernel is ready for IO operation. The following figure:
NIO (reactor model): Thread initiates IO request, returns immediately; After the kernel is ready
(AIO) NIO 2.0 introduces the concept of a new asynchronous channel and provides an implementation of asynchronous file channels and asynchronous socket channels. True asynchronous non-blocking I/O when asynchronous socket channels correspond to event-driven I/O (AIO) in UNIX network programming. He does not need too much selector to poll the registered channel for asynchronous reading and writing, thus simp
Unlike setting asynchronous IO in RHEL3 described in [Note225751.1], you do not need to set aio-max-size, and
Unlike setting asynchronous IO in RHEL3 described in [Note 225751.1], you do not need to set aio-max-size, and
1. First install the following necessary rpm packages with the root user
# Rpm-Uvh libaio-0.3.106-3.2.x86_64.rpm# Rpm-Uvh libaio-devel-0.3.106-3.2.x86_64.rpm
2. Supporting asynchronous
the code is simple and intuitive, and the disadvantage is that IO efficiency and extensibility have limitations, which can easily become the bottleneck of application performance.In many cases, people also classify some of the network APIs provided below java.net, such as sockets, ServerSocket, and HttpURLConnection, into the synchronous blocking IO class library because network traffic is also an IO behavior.Second, the NIO framework (Java.nio package), introduced in Java 1.4, provides new abs
the traditional blocking IO, and if it does not block, then it is non-blocking IO.
Received the operating system IO model, but also have to mention SELECT/POLL/EPOLL/IOCP, about the four understanding, not much to explain, I have not understood in place.Understandably, after Linux 2.6, the implementation of Java NIO is achieved through Epoll, which can be found through the source code of the JDK. AIO, which is implemented through IOCP on Windows, i
to read and write, continue to read and write, continuously looping until read-write is completed.
Java support for bio, NIO, AIO :
Java BIO: Synchronization and blocking, the server implementation mode for a connection to a thread, that is, the client has a connection request when the server needs to start a thread to process, if the connection does not do anything will cause unnecessary thread overhead, of course, can be improved thro
1. First install the following necessary rpm packages with the root user
# Rpm-Uvh libaio-0.3.106-3.2.x86_64.rpm# Rpm-Uvh libaio-devel-0.3.106-3.2.x86_64.rpm
2. Supporting asynchronous I/O at the system levelUnlike setting asynchronous IO in RHEL3 described in [Note 225751.1], you do not need to set aio-max-size, and the file does not exist in the '/proc/sys/fs' path. Since 2.6 kernel, I/O size restrictions have been removed [Note 549075.1]. In additi
The IO approach is usually divided into several, synchronized blocked bio, synchronous non-blocking NiO, asynchronous Non-blocking AIO
A. BIO
Before the JDK1.4 came out, when we set up a network connection with the Bio mode, we need to start a serversocket on the server, and then start the socket on the client to communicate to the server, by default, the server needs to set up a heap of threads to wait for the request, and the client sends the reques
blocked until read-write is completed).③ non-blocking: ATM queued withdrawals, you can call while waiting.
1.Java support for bio, NIO, AIO:①java BIO: Synchronization and blocking, the server implementation mode for a connection to a thread, that is, the client has a connection request when the server needs to start a thread to process, if the connection does not do anything will cause unnecessary thread overhead, of course, can be improved thro
is that it can listen to multiple file handles at the same time (if viewed from a UNP perspective, select is a synchronous operation.)Because the process also needs to read and write data after select, it can improve the concurrency of the system! (Java AIO (nio.2)) asynchronous non-blocking IO:in this mode, the user process only needs to initiate an IO operation and then return immediately, after the actual completion of the IO operation, the applic
Abstract: About Java io, many of us are stuck in the Java original API some stream above, then mentioned in the network bio, NIO, AIO and other keywords, do you understand the meaning of the word, and its basic principle?Note: This article is also the move brick transfer from the network, I think this question to three types of IO image to do a good job, so turned out and we learn together.Original: http://stevex.blog.51cto.com/4300375/1284437Let's ta
selectionkey,selectionkey indicates that the data for a channel on a selector is ready.This channel will only be selected if the data is ready.This enables NIO to implement a thread to monitor multiple clients.Differences and summaries of NIO and AIONio:1. When NiO prepares the data for processing by the application, the read/write process of the data is still done in the application thread , just splitting the waiting time into a separate thread.2. Save data preparation time (because selector
way, the advantage of using the Select function is that it can listen to multiple file handles at the same time (if viewed from a UNP perspective, select is a synchronous operation.) Because the process also needs to read and write data after select, it can improve the concurrency of the system!(Java AIO (nio.2)) asynchronous non-blocking IO:In this mode, the user process only needs to initiate an IO operation and then return immediately, after the a
AIO (asynchronous blocking IO) asynchronous blocking IONIO is a synchronous IO, because the program requires IO when it needs to get the IO permission to do the IO operation in person before the next operation. AIO is an improvement on NIO (so Aio is also called nio.2), which is based on the Proactor model. Each socket connection registers an IO completion event
reader to read and write, continue to read and write, continuously looping until read-write is completed.
Java support for bio, NIO, AIO :
Java BIO: Synchronization and blocking, the server implementation mode for a connection to a thread, that is, the client has a connection request when the server needs to start a thread to process, if the connection does not do anything will cause unnecessary thread overhead, of course, can be impro
Understanding of Bio,nio,aio in JAVABlog Category:
Network programming
"Turn from" http://qindongliang.iteye.com/blog/2018539In the high-performance IO system design, there are several noun concepts that often confuse us. Specific as follows:Serial number problem1 What is synchronization?2 What is async?3 What is blocking?4 What is non-blocking?5 What is sync blocking?6 What is synchronous non-blocking?7 What is asynchronous blocking?8 Wh
a read or write operation function implementation, blocking mode read or write function will wait, and not blocking mode, read or write function immediately return a status value.Therefore, IO operations can be divided into 3 categories: synchronous blocking (that is, early bio operations), synchronous non-blocking (NIO), asynchronous non-blocking (AIO).Sync blocking (BIO):In this way, the user process must wait for the IO operation to complete after
after select, it can improve the concurrency of the system!(Java AIO (nio.2)) asynchronous non-blocking IO:In this mode, the user process only needs to initiate an IO operation and then return immediately, after the actual completion of the IO operation, the application will get the IO operation to complete the notification, at this time the user process only need to process the data, do not need to do the actual IO read and write operations, Because
through the thread pool mechanism.Synchronous non-blocking IO (Java NIO): Synchronous non-blocking, the server implementation mode is a request for a thread, that is, the connection request sent by the client is registered to the multiplexer, and the multiplexer polls to the connection with an I/O request to start a thread for processing. The user process also needs to ask the IO operation to be ready from time to time, which requires the user process to keep asking.(Java
, resumes physical link
Setting the client link to non-blocking mode
Registers the newly accessed client connection to the selector of the reactor thread, listens for read operations, reads the network messages sent by the client
Asynchronously reads a client message to a buffer
Decodes a buffer, processes a half-packet message, encapsulates a successful message into a task
Encodes the reply message to buffer, calling Socketchannel's write to send the message asynchronously t
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.