Synchronous asynchronous blocking non-blocking (NIO) IO thread multiplexing minimalist description

Source: Internet
Author: User
Tags socket

synchronous asynchronous blocking non-blocking: nonsense do not say, Lao Zhang Love tea, boiled water, there are two kettle, ordinary kettle, Ring kettle (water meeting tips) (quoted) synchronization is ordinary kettle boiling water, to do nothing to come to see Open; Obstruction is the process of boiling water, you can not do other things (that is, you are blocked), non-blocking is the process of boiling water to do other things. For example, go out and chat with old flame, go to the living room to watch TV; synchronization and asynchrony are different ways of getting water open. Blocking and non-blocking says you can do other things before you get the results. The two sets of concepts describe different content. Here you see, you will find: The best way is to ring the kettle to boil water (asynchronous), burning prompts you to do something else (non-blocking) so asynchronous and non-blocking often together
io multiplexing: IO operations are time-consuming and synchronous (ie, ordinary kettles will not notify you if they are open and must be inspected by themselves). Description : 1000 socketio threads write data, after IO completes the next operation (such as copy, delete, etc.) 1000 Socketio threads equivalent to burning 1000 pot of water under the multi-threaded blocking model, 1000 socket processing threads are required, equivalent to 1000 old Zhang waiting for their own burning water to open (IO operation is finished), and then tea. blocking threads; 1000 Lao Zhang standing in front of the corresponding kettle cannot move (thread hangs) until his own water is opened
non-blocking threads: Lao Zhang does not have to wait for water to open, no matter come back to see, see not open (return value) on the other go, a will come back to see;
IO thread multiplexing: Even if it is non-blocking, every old Zhang has to wait for his water to open, it is very troublesome to come back to see it. Find a small Xu is responsible for viewing 1000 kettles, found that the water opened on the notice old Zhang (similar to asynchronous notification, thus known as pseudo-asynchronous) Once there is water, Lao Zhang can come to tea, waiting for Xiao Xu notice next, such an old Zhang is enough, or a number of old Zhang (thread pool)



Notifies single or multiple socket processing threads for next processing after each socketio thread state (pseudo-async) io is monitored through a single thread

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.