Personal understanding of the relationship between asynchrony and multithreading

  • 2020-05-10 22:58:17
  • OfStack

My personal understanding goes like this:

1.   asynchronous communication means that when A has sent a message, it continues to execute the program without waiting for a response from B, and at some point in the future,A checks to see if it has received a response from B.

        asynchrony is doing things independently of each other while waiting for an event, without waiting for the event to complete.

2. Multithreading is the logical layer concept of programming, which is a piece of code running concurrently in the process. Multiple threads can be used to switch execution between threads.

3. Asynchrony and synchronization are relative, synchronization is the sequential execution, the execution of one and then the execution of the next one, need to wait, coordinated operation. Threading is one way to achieve asynchrony. Asynchrony allows the main thread of the calling method to do other things without synchronously waiting for another thread to finish.

Asynchronous and multithreading is not an equal relationship, asynchronous is the ultimate goal, multithreading is only one of our means to achieve asynchronous. Asynchrony is when a call request is sent to the caller and the caller can do something else without waiting for the result to return. Asynchrony can be implemented by using multithreading or by handing it over to another process.


Related articles: