Looking for an explanation of the “asynchronous” word in .Net?

I need someone to explain the following names:

  • Asynchronous delegates.
  • Asynchronous methods.
  • Asynchronous events.

I am currently moving on to this exam 70-536, and so far I have covered all of my databases. The multithreading section and online resources were helpful to me during my second reading. However, the names used above mean absolutely nothing to me? I would really appreciate the meaning of the word "Asynchronous" and its meaning for delegates, methods, and events.

Feel free to go into the details as you like.

+4
source share
5 answers

"Asynchronous" describes the type of thread execution.

Synchronous commands execute linearly and prevent subsequent instructions from executing until completed (i.e. they block). So, given the following synchronous code:

DoOneThing(); DoAnotherThing(); 

DoAnotherThing not executed until DoOneThing completes.

Asynchronous instructions are different in that you do not know (or sometimes even care) when they start or end execution. In this case:

 DoOneAsynchronousThing(); DoAnotherThing(); 

The first statement initiates an asynchronous operation, then performs another thing immediately before the first operation (or perhaps even started).

There are many different mechanisms for providing asynchronous execution: the most common (at least in the .NET world) are probably ThreadPool (for asynchronous execution in the process) and Microsoft Message Queue (for interprocess asynchronous execution). For a .NET introduction, you can start with this MSDN topic, including asynchronous calls .

Thus, asynchronous delegates, methods, and events are triggered (and terminated) at undefined times and do not block the main thread of execution.

+12
source

I believe in learning and finding your answers when it comes to the exam.

Here are some articles.

Read the wiki: http://en.wikipedia.org/wiki/Asynchronous_communication

Or here, on "What is Asynchronous", this short and to such an extent: http://www.webopedia.com/TERM/A/asynchronous.html

For example, in my code, I have a serial port. One stream reads and one stream writes to the port. I can read and write at the same time (sort of), so this is ASYNC. If I were blocking incoming data while I was writing, then I would be synchronous.

+4
source

See the .NET documentation section on Asynchronous Programming Using Delegates .

In conclusion, delegates have a BeginInvoke method that allows them to be called asynchronously. When called, the target method runs in a separate thread. The calling thread may receive a callback when the target method has completed, and may call EndInvoke on the delegate to receive the results.

+3
source

Given what you posted, I assume that you know the difference between asynchronous and synchronous execution.

An asynchronous delegate (and usually an asynchronous event) simply means that the underlying method (or methods!) Is invoked asynchronously.

An asynchronous method is a method that performs an asynchronous operation (heh).

Sorry for the ambiguity, but if you understand what an asynchronous tool is, then this should point you in the right direction.

+2
source

If you are doing something synchronously, your application is waiting for the result: for example, ordering a hamburger while passing. You are pretty much stuck in line until the task (preparing burgers, billing, and delivery) is complete.

If you execute asynchronously, you do other things, rather than expect: for example, order pizza and watch a movie, waiting for its delivery.

+1
source

Source: https://habr.com/ru/post/1304288/


All Articles