Io,aio Simple comparison of Java

Source: Internet
Author: User

The following content is reproduced Lzzzl

Channel channels

Buffer buffers

Selector Selector

Where the channel corresponds to the previous stream, buffer is not something new, selector is because NIO can use asynchronous non-clogging mode to add something.

Before the flow is always blocked, a thread as long as the operation of it, the other operation will be blocked, it is equivalent to the water pipe no valve, when you reach out, whether the water is not, you can only consume in the water (flow).

The addition of the channel of NIO, equivalent to increasing the faucet (with a valve), although a moment can only be connected to a water pipe, but depending on the rotation strategy, when the water is small, the water flowing out of each pipe can be properly accepted, the key is to add a hydraulic, That is, selector, he is responsible for coordination, that is, to see which water pipe has a certain degree of water in the current time, switch: temporarily shut the current faucet, try to open another faucet (see if there is water).

When other people need water, not directly to the water, but the premise of a bucket to connect the hydraulic, this bucket is the buffer. That is, others may have to wait, but not at the scene, but go home and so on, you can do other things, water is full, the water union to inform them.

This is actually very close to the current social division of labor refinement of the reality, but also the use of existing resources to achieve the concurrency effect of a very economic means, rather than to a parallel processing, although that is the simplest, but also the most wasteful way of resources.

Io,aio Simple comparison of Java

Related Article

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.