What does it mean for a method to be asynchronous?

前端 未结 4 1214
一个人的身影
一个人的身影 2021-01-31 21:06

What is an asynchronous method. I think I know, but I keep confusing it with parallelism. I\'m not sure what the difference between an asynchronous method is and what parallel

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-31 21:38

    First you got to understand that if you want parallelism all the structure need to be parallel, I mean that if you have an asynchronous method you need a asynchronous call. In webservices or web stuff, asynchronous methods can be (just one of the many ways) called with AJAX which is asynchronous. In one method you can have multiple threads, this is the key difference between async methods and multiplie threads. And the main: the difference between a standard method and a async method is that if you make 2 calls to a standard method at the same time to the same controller with a asynchronous caller (like AJAX) the second call will just begin when the first call has already completed, if the methods that you called were asynchronous both the calls will begin at the same time, with multiple-cores servers it can achiev twice (2 calls) the standard speed. The speed of the parallelism is measured by this law.

提交回复
热议问题