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
Netty is an asynchronous event-driven network application framework for rapid development of high-performance, highly reliable network servers and client programs. In other words, Netty is a NIO framework that can be used to quickly and easily develop network applications, such as client and server-side protocols. This is a description of the official document, as a Java beginner, this is a noun nio is completely without concept, for this purpose, the special reference to the relevant informatio
application, this is actually the synchronization and the asynchronous most crucial difference, the synchronization must wait or the initiative to ask whether the IO completes, then why say is blocked? Because this is done by a select system call, and the Select function itself is implemented in a blocking 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
is a simple Web server based on AIO implementation, which is a simple example/** * A simple Web server The Web server concurrency performance based on AIO is higher than that of NiO and Netty implementations, and the main thing is that he is based on the Proactor IO processing model, which forwards the read and write operations to the right operating system.(Of course, the static pages here are relatively s
IO operation in Java is done by the JVM with the operating system. For a read operation of an IO, the data is first copied into the buffer of the operating system kernel and then copied from the buffer of the operating system kernel to the application's address space. So the whole process can be divided into two stages:
Wait for I/O data to be ready. This depends on the speed at which the IO target returns data, such as network IO and the size of the data itself.
The data is copied
Java, NIO, AIO-1Java Recently the use of TCP communication in the project to complete the command and operation results of the interaction with the typical TCP communication in the C/s architecture, the reason is simple: in the context of low business requirements, the structure is simple, stable and easy to write. However, in the actual deployment of the situation, there has been no reading of the null pointer exception, the supposedly bio-mode devel
IO has been one of the core parts of software development, and with the improvement of Internet technology, IO is becoming more and more important. Throughout the development community, the ability to skillfully use IO is important not only for companies but also for developers. Java's IO mechanism is constantly being perfected to cope with increasing traffic.
Java IO the way
First, the traditional java.io package provides abstraction, input, and output streams such as file. Interactive mode is
the Accept method of Asynchronousserversocketchannel accepts a connection request
Here is a simple example,Server-side1 PackageAio;2 3 Importjava.io.IOException;4 Importjava.net.InetSocketAddress;5 ImportJava.nio.ByteBuffer;6 ImportJava.nio.channels.AsynchronousServerSocketChannel;7 ImportJava.nio.channels.AsynchronousSocketChannel;8 Importjava.util.concurrent.ExecutionException;9 Importjava.util.concurrent.Future;Ten One Public classServer { A Private Static Final intPORT = 3002; -
Recently in Tomcat optimization, it was found that Tomcat Connector concurrent support for Bio NiO APR, discovering the understanding that you want to understand Tomcat concurrency without Java io. All this article first explores Java's support for IO. Java IO requires operating system support, this article describes the Linux system to IO Support, Windows system because the Java generation environment used less discussed.I. Support for Linux OS IO1. Synchronous Blocking I/O (bio) 2. Synchronou
have been preparing for an interview recently, in order to make their Java level a notch, read the Li Lin Teacher's
"Netty authoritative guide", learned Java about IO development and the latest technology, really benefit, now put
My summary of the differences and application scenarios for bio, NIO and AIO is summarized once again.
Before that, let's find out a few concepts:
1. Synchronization: When using synchronous io, Java handles IO read and wr
Linux Kernel '/fs/aio. c' local information leakage Vulnerability
Release date:Updated on:
Affected Systems:Linux kernelDescription:--------------------------------------------------------------------------------Bugtraq id: 68176CVE (CAN) ID: CVE-2014-0206Linux Kernel is the Kernel of the Linux operating system.In the AIO subsystem of Linux Kernel, The aio_read_events_ring () function does not properly filt
Over the past few days, I have been working on a large volume of data solutions for linux. I have continuously learned about aio, epoll, libevent, boost: asio. In the past, I only knew that they are both asynchronous and non-blocking, but what are the key points to solve the problem? Through these several days of in-depth understanding, I will summarize them:
Aio is the asynchronous IO implemented by the ke
A simple example of epoll/AIO/eventfd in combination _ sunfly _ Sina Blog
A simple example of epoll/AIO/eventfd(00:37:41)Reprinted tokenTags:EpollLibaioEventfdMiscellaneous# DEFINE _ gnu_source# DEFINE _ stdc_format_macros# Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Include # Define test_file "aio_test_file"# Define test_file_size (127*10
only operates on the active socket, because in the kernel implementation, Epoll is based on each FD above the callback function to achieve the amount, only the active socket will be active call callback function NBSP;3 use mmap to accelerate the kernel and user space message delivery, Epoll is implemented through the kernel and user space mmap the same piece of memory jdk1.7 Upgrade the original NiO class 1 provide the API to get the file attributes in bulk, These APIs are platform agno
comes back. (Of course, the real world is not, but it is true in computers.) )4 Non-blocking non-blocking state, if there is nothing to read, or not to write, read and write function immediately return, and do not wait, the bank in the withdrawal business, collect a small ticket, we can play mobile phone after the collection, or chat with others, when the wheel we, the bank's horn will be notified, this time we can go.Java support for bio, NIO, AIO:Java BIO: Synchronization and blocking, the se
operation to be ready from time to time, which requires the user process to continually inquire, thereby introducing unnecessary waste of CPU resources. Asynchronous blocking Io (Java NIO):
This means that after the application initiates an IO operation, do not wait for kernel IO operations to complete, and so the kernel completes the IO operation will notify the application, this is actually synchronous and asynchronous the most critical difference, synchronization must wait or actively ask IO
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.