I/O model

Source: Internet
Author: User

What is I/O model, when I first approached the problem, it was a very persistent problem for me as a layman (I was a car-learning person). At the beginning of the basic computer these did not say much, also may have said, but forgot ^_^ ...

I am a conservative with the point of the people, which also cast my character belongs to the type of hate, so, for the more interesting things, attention! It's a thing! Not gossip ... coincidentally, for men, fresh electronics, like football, can always win high attention, even more than women, which is self-evident. So for a long time for this kind of expensive precision products are still more enthusiastic, is the kind of relatively superficial enthusiasm, only for the appearance and fun, never carefully explored the mystery.

in my eyes, I/O or stay in the BIOS phase, the basic input and output system is still remember more clearly, the display is output, keyboard mouse input, the other do not know, but real-time proof, labor, wrong, the wrong mess. So let's talk about the I/O model. >_<!!!

Suppose two hosts A,b,a(callee) is able to provide the service,B cansend a call requestto the callee (a) by a system call running on its own, and a receives the call request, Returns the result of the run to the caller (B). This is an I/O.

It is also possible to think that we have a read operation on the disk, the request call is issued by the user space, because only the kernel can invoke the data on the disk, so the user's request should be sent to the kernel, the kernel to the disk to extract the appropriate files, and stored in kernel memory, The data in the kernel memory is then copied to the user space. Note: The real I/O here is just this section of kernel space that replicates data to user space.

There are several classification methods for I/O, which can be divided into synchronous (synchronous) and asynchronous (asynchronous), synchronous and asynchronous, which focus on the message notification mechanism, also can be divided into blocking (block ) and non-blocking (nonblock), blocking and non-blocking concerns the status of callers waiting for the caller to return the result of the call.

Synchronization: The call does not return immediately after the issue, and once returned, the final result is returned;

Asynchronous: After the call is issued, the callee returns the message immediately, but the return is not the final result; the callee notifies the caller by state, notification mechanism, etc., or the result is handled by a callback function;

Blocking: The caller is suspended until the result of the call is returned, and the caller can continue only after the returned result is obtained; (Explanation: Imagine one thing to run on)

Non-blocking: The caller will not be suspended until the result is returned, i.e. the call will not block the caller; (Explanation: Several things allow simultaneous operation)

based on the above definition, the next I/O model can be well understood thatthe I/O model is divided into five kinds:

1. blocking I/O(blocking I/O)

2. non-blocking I/O(nonblockingi/o)

3. multiplexed IO (iomultiplexing)

4. Event-driven io(signaldriven io)

5. Asynchronous IO(asynchronousio)

What do these five kinds of things mean ? As an example:

1, if a client requests a page to the server, then the server will load the page to the client, however, during this load period, the server will not be able to respond to other user requests, until the page is loaded, in order to respond to other user requests, which is blocking I/O ;

2, disk read operation where the client sends a request to the kernel, The kernel responds with an immediate response to a result indicating that the request was received, and then in addition to the actual i/o i/o finish (note: Make a real i/o is also a blocked i/ O So, for some of the real i/o i/o< Span style= "font-family: ' The song Body '; Does not bring a performance boost;

3, multiplexing type I/O, a modelsimilar to the LVS load balancer, by a scheduler-like component (here called Select) toassign various requests to the back-end of the child process to run, so that can be processed at the same time N requests, but this number also has an upper limit, which is the reasonwhy the maximum concurrency of the prefork model is the size of the 1024x768 . Multiplexing I/O is also blocking, only blocking on select ;

4, event-driven I/O, after the request sent to thekernel, the kernel will immediately respond to the user space a signal, and after processing the notification user space, so that user space without blind waiting, while the kernel calls the disk file can also respond to other requests from the user control, This enables a single process to respond to multiple requests. But the kernel space and user space really occurs when I/O is still blocking I/O;

5, asynchronous I/O, after the user space sends the request to the kernel, the kernel responds to a signal immediately, then notifies the user of space after all other things have been processed, even the replication of the kernel space to the user space is non-blocking.

To do as a reference:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/C0/wKioL1WGTbuhlLXbAAGvMaVZ3S4546.jpg "title=" 1.png " alt= "Wkiol1wgtbuhllxbaagvmavz3s4546.jpg"/>


I/O model

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.