The content of this section:
Introduction to I/O Models
Blocking I/O (blocking IO)
non-blocking I/O (non-blocking IO)
multiplexed I/O (IO Multiplexing)
Asynchronous I/O (asynchronous I/o)
IO Model comparison and analysis
Selectors module
Introduction to an
Waiting for data preparation (waiting for theCopy data from the kernel into the process (Copying the data from the kernel-the process)Stevens compared five IO Model in the article:Blocking IOnonblocking IOIO multiplexingSignal Driven IOAsynchronous IOSince signal driven IO is not commonly used in practice, I only refer to the remaining four IO Model.Blocking
I reviewed the concepts related to Io, NIO and AIO in the morning and recorded some of these points.
from the programming language level
BIO | NIO | AIO in the Java perspective, understanding, Linux C also has the concept of AIO (library), these concepts do not know what reason is fired up, here only from the Java perspective.
BIO, synchronous blocking Io, simple comprehension: One connect
a general concept of performance optimization
It is generally believed that Java programs are always slower than C programs, and most people may have heard too much about this kind of advice. In fact, the situation is far more complicated than the old claims. Many Java programs are really slow, but slow speed is not an intrinsic feature of all Java programs. Many Java programs can achieve the efficiency of similar programs in C or C + +, but this is only possible when designers and programmers p
1.1.Event-Driven Event-driven is a programming paradigm, a programming style that specializes in dealing with unknown events by binding an event, activating the thing after an external trigger, and achieving the purpose of performing certain operations. such as the browser's onclick () event1.2.IO Model Basics Before interpreting, there are a few concepts to be explained:
User space and kernel space
Process switching
Blocking of proc
According to UNIX network programming, Io models can be divided into: Blocking Io, non-blocking Io, Io multiplexing, signal-driven Io and asynchronous Io, according to the POSIX standard, there are only two types: Synchronous
In order to prevent crawlers from crawling articles on unscrupulous websites, we hereby mark and repost the source of the article. Laplacedemon/sjq.
Http://www.cnblogs.com/shijiaqi1066/p/3826251.html
Socket. Io
Socket. Io is used for real-time communication between the browser and node. js. Socket. Io is designed to support any browser and any mobile device. Su
Io (input and output) operations in java (1), iooutputIO, short for Input and Output. In java, IO involves a large range. Here we mainly discuss the reading and writing of file content.Other knowledge points will be placed in subsequent chapters (I think the article is too long and no one has the patience to go to the end)There are two main types of operations on file content: They are: Ghost stream Byte
In the past, people only knew that flash should replace hard disks, and Flash should be optimized for applications. However, with the development of the flash application, the application needs to be optimized for flash. Fusion-Io is working to drive this change.
Although storage vendors have launched a variety of FLASH products or systems, most storage vendors only use flash as a replacement for hard disks, such as replacing hard disks in disk arrays
IO, short for Input and Output. In java, IO involves a large range. Here we mainly discuss the reading and writing of file content.
Other knowledge points will be placed in subsequent chapters (I think the article is too long and no one has the patience to go to the end)
There are two main types of operations on file content: They are: Ghost stream Byte stream The volume stream has two abstract classes:
analysis of high performance IO model
Server-side programming often requires the construction of a high-performance IO model, with four of common IO models:
(1) Synchronous blocking IO (Blocking io): The traditional IO model.
(2
The provisions in POSIX for synchronous IO and asynchronous IO :Synchronous IO Operation: Causes blocking of process until IO operation completes, asynchronous IO operation: IO operation does not cause process blockingunder UNIX,
encounters an IO operation to automatically switch to another coprocessor
A small example of a process manually switching IO operations
Greenlet is a C implementation of the process module compared to the yield of Python and it can allow you to arbitrarily switch between any function without the need to declare this function as generator
Import Greenlet def test1 (): print (All) g2.switch () print
Basic Java IO knowledge (I)Java IO Overview
I/O is the core issue of human-computer interaction, Because I/O is the main channel for computers to acquire and exchange data.
The entire IO process is the source data ---> program ---> destination
IO Classification
Character-based I/O interfaces: Reader, Writer I/O
Type Pipewriter
Copy Code code as follows:
Type Pipewriter struct {
Contains filtered or unexported fields
}
(1) Func (w *pipewriter) Close () error closes the pipe, the read operation in progress will return EOF if there is still unread data in the pipe, and the subsequent reading is still normal
Copy Code code as follows:
Import (
"FMT"
"IO"
)
Func Main () {R, W: =
Blocking: When a user process accesses data, if IO is not completed, wait for IO to complete or make a system call to determine whether IO is completeNon-blocking: When a user process accesses data, it returns a status value immediately, whether or not it completes
Sync: Polling kernel state after user process initiates IO
In JDK 1.4, the NIO package is added, which is aimed at improving the IO speed. However, we all know that with the NIO package added, the old Io package is actually overwritten. Even if the NIO package is not displayed, You can obviously feel the speed improvement.
In addition, many people only know the inputstream or outputstream of the buffer when using the IO
Document directory
Main methods and constants in the file class
Procedure
Byte output stream: outputstream
Byte input stream: inputstream
Character output stream: writer
Character input stream: Reader
File class
In the entire Io package, the only class that indicates the file itself is the file class. You can use the File class to create or delete files. To use the File class, you must first observe the construction method of the file class.
In Linux 2.6, there are four Io scheduling algorithms. The following is a summary:
1) NoopThe Noop algorithm is completely written as no operation. This algorithm implements the simplest FIFO queue. All IO requests are operated in the first-to-last-order. The reason is that Noop merges adjacent IO requests on the basis of FIFO, rather than completely satisfying
having each Ser Vice (voice/data) operating acceptably.In other words, we can theoretically determine how the performance would is for the digital link.Note:it is worth remembering here's a very complex subject. As always, we try to introduce to the most simplified possible through the use of examples and simple concepts. Okay?For example, a concept this could be explored here-since we is talking about digital communication system-is the Nois E figure. But we don't want to repeat the theory exp
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.