synchronous, asynchronous, blocking, non-blocking

Source: Internet
Author: User

Synchronous, asynchronous is the API is called by the method of notification, focus on the way of collaboration, blocking, non-blocking API caller's wait mode, the focus is on the execution state of the thread. As an example:

1, you go to the bookstore to buy books, see the boss asked him if he has "slam dunk", the boss said no, and then you just wait here, or go back a few days to run to ask the boss there is no, until the book (of course, also may boss has not entered this book, then you can only continue to run down ...) ), this is the synchronization

2, or you, and go to the bookstore to buy books, this time to buy is "The King of Thieves" bar, the boss said no (no way, the child is too bad), but this time you and the boss agreed, the book to call you, after a few days, the boss informed you the book, shouted you to buy, this is asynchronous

3, buy "slam dunk" when, if you have been waiting for nothing to do until you buy a book, is blocking; If you are not a book to run back to play a few days, do some of their own things, every few days in the reading to read to No, until the book, which is non-blocking

4, buy "King of Thieves" time, the book has not arrived, you will also have some fun, watching movies play games, this is asynchronous non-blocking

Summarize:

1, synchronous and asynchronous: Synchronization refers to the caller actively get the return value of a function call, asynchronous refers to the callee when the function is returned when the active notification to the caller can get the return value

2, blocking, and non-blocking: blocking refers to the fact that a thread can do nothing (discard CPU time slices) while waiting for the return value of a function call, rather than blocking refers to the thread doing other things in the process

synchronous, asynchronous, blocking, non-blocking

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.