Bio, NiO, Aio

Source: Internet
Author: User

I. Basic Concepts

Synchronization: the caller will wait until the result goes down. I call a result and wait until the result is returned.

Asynchronous: you do not need to wait for the result after calling the interface. I will be notified of the result.

The difference between the two is whether or not to wait for the result. What will wait for the result is synchronization, and what will not wait for the result is asynchronous.

Blocking: The current thread is suspended while waiting for the returned result.

Non-blocking: I can do other things while waiting for the returned results.

Blocking and non-blocking focus on the status when the program is waiting for the call result (message, return value.

For example, I called the bookstore and asked my boss if he had the book "Distributed System.

The synchronization mechanism is: the boss will say, wait for me to check, the result may have been checked for five minutes, or for several days. After checking, let me know, I have been waiting for it.

The asynchronous mechanism is: the boss will say, wait for me to find it and give you a call. Notify me through callback.

The blocking mechanism is: when you wait for a response, you will suspend yourself until you get the result of this book.

The non-blocking mechanism is: no matter whether the boss tells you, you play first, but check whether the boss has answered you later.

Ii. Bio (Block Io blocking Io): the server will open a dedicated thread for each client link, that is, the relationship between 1vs1. The number of threads that a server can start is fixed, if a bunch of requests come in, the server will definitely be suspended. This solution is not good.

Iii. NiO (non-block Io synchronous non-blocking Io ):

 

Bio, NiO, Aio

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.