Where are asynchronous operations waiting when they can't handle them?

If I run a group of asynchronous operations in C # (Tasks), each loading content from the network, and then I process the first available result of the task using Task.WhenAny (), where other async operations “wait” while the main thread processes the results?

I can only assume that there is some kind of internal queue at the OS level that stores the state, as well as boot results, occurring in the background.

My question is: where is this queue located and are there any dangers of this queue crowded with the results of asynchronous operations that have not yet been processed?

+4
source share
1 answer

Planners TPL tasks track these tasks started using the Task.Run, Task.Factory.StartNew, Task.ContinueWith, Task.Runor Task.RunSynchronously.

For promise , style tasks (created using TaskCompletionSource), links are saved using I / O completion callbacks or event handlers. Stephen Cleary has an excellent blog post related to this task category.

, (, async await ), , "" ( awaiter), " ". (, TaskAwaiter). , , ( "" ) . "" , SynchronizationContext.Post TaskScheduler.Current ( , await).

, awaiters , await, INotifyCompletion.OnCompleted, , " ".

, - , ?

, , . , Queuing Theory, - TPL.

+5

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


All Articles