C# & CLR Internals (50 Qs)•Part 2: Concurrency, Zero-Allocation & Advanced Language Features (11 - 24)
How do you identify and prevent ThreadPool Starvation and sync-over-async deadlocks?
senior LevelAsync & Promises
In Simple Words:
Calling .Result or .Wait() on an asynchronous task blocks the current thread until the task completes. Under high concurrent load, this locks all available ThreadPool worker threads, leaving zero threads to actually complete the pending tasks—causing ThreadPool Starvation and system freeze.
The Golden Rule:
Async all the way down: Always await asynchronous operations; never use .GetAwaiter().GetResult().