Skip to content
0:00 / 0:00

#asyncawait#dotnet#stephentoub

Deep .NET: Writing async/await from scratch in C# with Stephen Toub and Scott Hanselman

dotnet

357K subscribers • 45 videos on Hallway

YouTube
  • Recommended by 7 people: 7 in engineering communities.
  • Presented by Stephen Toub and Scott Hanselman

Advanced. Deep dive for people who know the field.

226K views2 years ago7 recommendations

Programming languagesSystems programmingC# and .NETConcurrency and parallelismPerformance and optimization

Stephen Toub and Scott Hanselman demystify asynchronous programming in .NET by building a custom ThreadPool and Task implementation from scratch.

Join Stephen Toub and Scott Hanselman as they dive deep into the world of .NET. On this first episode, Stephen and Scott demystify the world of asynchronous programing with .NET and specifically the magic behind async/await, something that developers use every day. To do so, he builds his very own implementation of async/await completely from scratch and explains throughout the way. If you are looking to go deeper with .NET then you are in the right place. Chapters: - Intro - Understanding concurrency, parallelism, and asynchronous - Creating our own ThreadPool - Creating our own Task - Putting together ThreadPool and Tasks - Async iterators and yield - Wrap-up Resources: Blog: devblogs.microsoft.com/dotnet/how-async-await-really-works/ Docs: learn.microsoft.com/dotnet/csharp/asynchronous-programming/ Final Code: gist.github.com/jamesmontemagno/12992547430b85723e997a312f13… Connect with .NET: Blog: aka.ms/dotnet/blog Twitter: aka.ms/dotnet/twitter TikTok: aka.ms/dotnet/tiktok Mastodon: aka.ms/dotnet/mastodon LinkedIn: aka.ms/dotnet/linkedin Facebook: aka.ms/dotnet/facebook Docs: learn.microsoft.com/dotnet Forums: aka.ms/dotnet/forums 🙋‍♀️Q&A: aka.ms/dotnet-qa 👨‍🎓Microsoft Learn: aka.ms/learndotnet #dotnet #asyncawait #csharp

Why it's here

7 people recommend this

What people say. Highly recommended as a masterpiece explanation of how async/await and the task state machine work under the hood in .NET.

u/jithinj_johnsonin r/dotnet • Recommends

On “Why do some non-.NET devs see async-await syntax as bad?”

Because they haven't seen this banger yet! \Writing async/await from scratch in C# with Stephen Toub\

u/pceimpulsivein r/dotnet • Recommends

On “did you know every async method you write allocates a heap object you never see?”

Yes I did, I think from when I watched this great video link to this video

u/BetaRhoOmegain r/dotnet • Recommends

On “Ten Months with Copilot Coding Agent in dotnet/runtime - .NET Blog”

This article is rich with detail and I appreciated the deep dive, especially because I respect Stephen Toub so much ([seriously if you haven't watched his and Scott Hanselman's deep dot net series, please check it out]). However I find myself coming out of this article less excited and more deflated. I can't shake the feeling that my career is about to fundamentally change, and the parts of the job I enjoy the most will be stripped away. I noted a dozen interesting things in the article to myself while writing personal notes, but these parts stand out to me: >On January 6th, 2026, I boarded a cross-country flight to Redmond, WA. No laptop (or, rather, no ability to charge my power-hungry l…

u/VoteBNMW_2024in r/dotnet • Recommends

On “You want DEEP technical #dotnet content? Toub and Hanselman and the internals of the Regular Expressions Engine”

Full playlist which is great link to this video

u/qrzychu69in r/dotnet • Recommends

On “Is async/await really that different from using threads?”

…uld be done by the same context as previous one - very useful when programing UI, since many things have to be done on the main thread. It has a separate Todo list from your normal thread pool. The whole thing is pretty cool, but kind of hard to explain to people without a good grasp of programming, that's why we usually use the kitchen example. link to this video here you can see Stephen Toub create the whole thing from scratch…

u/qrzychu69in r/dotnet • Recommends

On “Technical Interview”

How does async work? (The state machine behind, continuations, watch this: link to this video What does the using statement do? (It's just fancy syntax for try/finally) We usually also ask about LINQ The rest is pretty much random :)

u/ScandInBeiin r/dotnet • Recommends

On “Explain async/await to me like I'm 5”

> Should this be an async method with "return await /.../", or should it be like it is now? Unless it is extremely performance critical use await as the stack trace will be correct. I cannot recommend the youtube video "Writing async/await from scratch in C# with Stephen Toub" enough if you want to understand  how async await works! link to this video

u/xcomcmdrin r/dotnet • Recommends

On “Need recommendations/ resources for learning .NET core and C# for interview ”

The Microsoft dotnet youtube channel, for example: Deep .NET: Writing async/await from scratch in C# with Stephen Toub and Scott Hanselman: link to this video

u/NoSelection5730in r/dotnet • Mentions

On “Learning how things work under the hood resources”

I'd advise against spending your free time learning the framework. Frameworks come and go like fashion and getting too attached to any of them WILL have bad results on your ability to evaluate your own technical skill and the value of other frameworks and languages. There's a lot of great resources online, I'd recommend Deep Dotnet by Stephen Toub. I've linked a good one below. link to this video

u/mando0072021in r/dotnet • Mentions

On “Async/Await - Beyond the basics”

If you really want beyond the basics of async/await here's a video that explains the internals by implementing it from scratch- link to this video

u/PRektelin r/dotnet • Mentions

On “Async\Await\Threading\TPL in .NET interview preparation resources”

link to this video Stephen Toub, the goat

u/sonurmusicin r/dotnet • Mentions

On “Async/Await - Beyond the basics”

There is youtube video where Scott Hanselman and Stephen Toub do a deep dive on Async Await. I recommend checking it out. link to this video

u/SchlaWiener4711in r/dotnet • Mentions

On “Is async/await really that different from using threads?”

Ies suggest you watch "writing async/await from scratch" with Scott Hanselmann and Stephen Toub. link to this video The "Deep .Net" series is really great. And my two cents: before async/await third party libraries often did not use multithreading and expected you to run a thread yourself to be non blocking. (Or used the Begin... And End... pattern) And that's a good thing. Imagine your code running threads calling a third party library that itself is running threads calling another library also running threads. That would blow up resource usage. Tasks solved this by adding a standardized way of "borrowing" a thread and executing code from a shared pool. But there was still no easy or standardi…