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