Js synchronization, Asynchronization, blocking, and non-blocking knowledge points

Source: Internet
Author: User

Js synchronization, Asynchronization, blocking, and non-blocking knowledge points

What are you talking about when you are talking about synchronization, Asynchronization, blocking, and non-blocking?

The description of a term should have a target object.

Those who talk about synchronization and Asynchronization never talk about who the target object is. There are many participants in the running process of the program. In the end, this synchronization is used to describe who it is?

In my personal understanding, synchronous and asynchronous descriptions are a behavior method, and blocking and non-blocking descriptions are a state.

In js, we talk about synchronization, that is, synchronous calling. For example:

The Code is as follows:  
Function (){

B ();

C ();

}

Then A initiates A synchronous call to B and C. The subject here is. When executing A, execute B first. When executing C, they follow A strict sequence. It is actually a sequential execution. This is the specific feature of synchronization.

While asynchronous calling is actually about asynchronous calling. The specific feature is to change the code execution sequence. In js, it is actually about delayed execution.

For example:

The Code is as follows:  

Function (){

SetTimeout (B (), 200 );

C ();

}

In this case, B is delayed. When A is running, C () is executed first and B () is executed. This is the asynchronous call of a to B .; However, the execution of the setTimeout (B (), 200) Statement and C still follows a strict sequence, but the execution sequence of C and B has changed.

I think it is clearer to describe this phenomenon using synchronous calls and asynchronous calls.

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.