Writing async/await from scratch in C# with Stephen Toub

  Рет қаралды 100,966

dotnet

dotnet

Күн бұрын

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:
00:00 - Intro
03:00 - Understanding concurrency, parallelism, and asynchronous
08:30 - Creating our own ThreadPool
26:00 - Creating our own Task
45:30 - Putting together ThreadPool and Tasks
56:00 - Async iterators and yield
01:05:00 - Wrap-up
Resources:
Blog: devblogs.microsoft.com/dotnet...
Docs: learn.microsoft.com/dotnet/cs...
Final Code: gist.github.com/jamesmontemag...
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

Пікірлер: 223
@majixx
@majixx 2 ай бұрын
Stephen Toub is an absolute treasure for all .NET developers. We defiantly need more content from him. What a great orator and teacher!!
@FilipCordas
@FilipCordas 2 ай бұрын
You have to give credit to Hanselman as well he is the best at preventing not to know anything when in fact he is probably as knowledgeable as Stephen.
@davecenter2002
@davecenter2002 2 ай бұрын
I love Hanselman and he’s fantastic, but he absolutely is nowhere close to as knowledgeable as Stephen.
@shanselman
@shanselman 2 ай бұрын
@@davecenter2002can confirm. We have different jobs. Plus he kinda wrote the thing. 😂
@michaltomorowicz596
@michaltomorowicz596 2 ай бұрын
when you have two legends in one vid, debating who is a bigger legend is like arguing which type of sugar is sweeter :D awesome content
@san30911
@san30911 2 ай бұрын
Totally. He made me fall in love with C#...
@elerius2
@elerius2 2 ай бұрын
More of this, please! Feels like a channel9 video from back in the day.
@dotnet
@dotnet 2 ай бұрын
Oh we got more!!!
@theFijian
@theFijian 2 ай бұрын
Lol Channel9 really does feel like "back in the day" 🤣
@vacc1001
@vacc1001 2 ай бұрын
@@dotnet Is there a place where I can find more videos like this?
@dotnet
@dotnet 2 ай бұрын
@@vacc1001 We are releasing more and more. Subscribe and checkout the playlist: kzfaq.info/sun/PLdo4fOcmZ0oX8eqDkSw4hH9cSehrGgdr1
@tomglenn6019
@tomglenn6019 2 ай бұрын
I was already very familiar with how tasks/async/await work under the covers but seeing Stephen effortlessly "reimplement" it without copying and pasting or using notes is a humble masterclass of intellectual horsepower.
@s.hosseinhosseini8330
@s.hosseinhosseini8330 2 ай бұрын
This was amazing. Why I love this? 1. Scott Hanselman 2. Stephen Toub 3. An actual deep dive into a concept with a high-quality explanation of it.
@computer9764
@computer9764 2 ай бұрын
3.1. It didn't have a ridiculous thumbnail.
@Daysra
@Daysra 2 ай бұрын
Can I just say how great this duo is. Stephen is awesome at explaining things to a great depth, and Scott knows exactly where to stop and ask for clarifications, at an extent that hits just the sweet spot for me, not being too much. More videos from this duo please.
@ThorstenSauter
@ThorstenSauter 2 ай бұрын
This was an absolute delight to watch. Thank you Stephen and Scott!
@Anubis10110
@Anubis10110 2 ай бұрын
Wow we need more topic like this please. We need more of .net core internals
@dotnet
@dotnet 2 ай бұрын
Oh we have more!!!!!
@umarahmad3705
@umarahmad3705 2 ай бұрын
Looking forward to more ​@@dotnet
@umarahmad3705
@umarahmad3705 2 ай бұрын
​@@dotnetor do you already have a playlist with topics like this
@umarahmad3705
@umarahmad3705 2 ай бұрын
Strongly agree
@gpltaylor
@gpltaylor 2 ай бұрын
When I say that I have watched every video and read every article about async and await, I am not exaggerating. However not a single one has come close to educating what this does, why and how to use it and how this is implemented as this does. This is one of the best videos I have seen on this subject. I would love to see more videos like this, that deep dive into the technical rather than floating around at surface level
@ghostg6107
@ghostg6107 Ай бұрын
Kevin Gosse also did a deep dive on async await. Stephen Cleary has a walkthrough of the history of Task.
@tedchirvasiu
@tedchirvasiu 2 ай бұрын
I love how Scott asks all the right questions.
@shanselman
@shanselman 2 ай бұрын
@CecilPhillip
@CecilPhillip 2 ай бұрын
Great video. Would love to see a dive into IAsyncEnumerable implementations
@dotnet
@dotnet 2 ай бұрын
Thanks for the idea! Hope you are doing well Cecil 💖
@ChaseFreedomMusician
@ChaseFreedomMusician 2 ай бұрын
@@dotnet I would love to see an example implementation of IQueryable, it is so non-approachable even for simple tasks, but it is an incredibly powerful feature.
@ArnonDanon
@ArnonDanon 2 ай бұрын
Scott & Stephen rewriting async await reminded me David & Damian rewriting SignalR on stage. All dotnet devs out there are standing on the shoulders of Giants🙏🏼 This is great content
@metaturso
@metaturso 2 ай бұрын
Link please?
@WespazjansDad
@WespazjansDad Ай бұрын
Superb stuff. Scott leads it well, without interrupting too much. And Stephen delivers pure meat. That is one of these few precious resources that despite the fact they last for ah hour, I personally need a few hours to analyze, rewind and make sure all these topics really click in my head.
@runtimmytimer
@runtimmytimer 2 ай бұрын
Love this deep dive stuff. Too much 101 content and almost zero 400 content.
@zksward
@zksward 2 ай бұрын
Really love to see this kind of in depth content coming from the team. We need mooooore!
@bity-bite
@bity-bite 2 ай бұрын
Great video! I love this style of rewriting stuff to explain how it works internally. We'd love more videos like this one
@pmnm113
@pmnm113 2 ай бұрын
after watching this I am youtubing about Stephen Toub videos. We need more content from him. I was nice to see low level design of async await here. thanks!
@fredyjimenez4853
@fredyjimenez4853 2 ай бұрын
This is best explanation to fully understand async/await. Greate quality content Kudos to Scott and Stephen
@CraigShearer
@CraigShearer 2 ай бұрын
Great info. Been away from C# for a few years, but nice to see this detailed as to how async/await works.
@StephenGierek
@StephenGierek 2 ай бұрын
This was really great! I've always struggled wrapping my head around how async/await works, but this method of instruction is extremely effective in conveying what's going on under the hood. Please, more like this. I could watch these all day long. 🙂
@MatthiWare
@MatthiWare 2 ай бұрын
Amazing video! I would love to see more content like this.
@FXK23
@FXK23 2 ай бұрын
Definitely going to watch this again and code along. Excellent video!
@minimalistdeveloper
@minimalistdeveloper 2 ай бұрын
Loved this. This is the video equivalent of Csharp in Depth and CLR via Csharp. Kindly do more of these level 300 topics.
@VukManic
@VukManic 2 ай бұрын
What an amazing video! This is one of best video to understand async await!!!! Thanks to both of you! Really enjoyed it!
@SlackwareNVM
@SlackwareNVM 2 ай бұрын
This was fantastic! I'd love a couple of more episodes that go into the optimizations that can be layered on top of this implementation.
@mambocollective
@mambocollective Ай бұрын
Great video. Learnt so much from this. Definitely need more content like this, especially with Stephen. It worked so well with him leading the way and then you pulling him back with questions I had in my own head. Looking forward to more of this sort of content.🤩
@moke_codes
@moke_codes 2 ай бұрын
This was amazing! I wish we could see more advanced topics like this. Learned a lot! Thanks guys!
@DannysGalaxyTab
@DannysGalaxyTab 2 ай бұрын
What a great video idea. Great hosts to listen to as well.
@paaabl0.
@paaabl0. 2 ай бұрын
Brilliant demo! Thank you guys!
@vedantkoditkar5968
@vedantkoditkar5968 2 ай бұрын
If only there is a way to give million up vote to this video. I always look forwards to Stephen Toub videos, his explanation is top notch.
@pachanga5382
@pachanga5382 2 ай бұрын
Excellent video-I was wondering at first why I needed to know this, and now I know!
@fullemptiness
@fullemptiness 2 ай бұрын
What a great idea to teach such a complex topic! It's like you found the missing piece in my (most .NET devs?) understanding to async programming!... Please do a series on async programming like this episode. Thanks!
@TheProTip
@TheProTip Ай бұрын
This is great. I've never actually heard Stephen talk though I've read a bunch of his perf reports and other posts. He presents very well.
@--Eric--
@--Eric-- 2 ай бұрын
Thanks Stephen and Scott, this was a great session. More please... 👏🏼
@ChaseFreedomMusician
@ChaseFreedomMusician 2 ай бұрын
This is by far one of my favorite videos to-date.
@neeleshbodgal7479
@neeleshbodgal7479 2 ай бұрын
That helps to understand more and better about the Task API. Stephen Toub blogs are worth reading that always teach me something new 😀
@cheekychappy1234
@cheekychappy1234 Ай бұрын
Such a fantastic video! Keep producing more and don't be afraid to dive deeper and deeper.
@codewithkhondamir
@codewithkhondamir 2 ай бұрын
That’s amazing. Thanks Scott and Stephen.
@acedonk
@acedonk 2 ай бұрын
This was a masterclass, thanks!
@fifty6737
@fifty6737 2 ай бұрын
awesome video, always pleasure to listen to stephen
@imranhussain8700
@imranhussain8700 2 ай бұрын
This is some crazy stuff. Stephen Toub is amazing. Scott Hanselman has done a fantastic job as usual for the viewers to ensure the topic is covered as much in depth as possible. Thank you very much. We need morrrrrrrrrrrrrrreeeeeeeeeeeeeeeeeee of these for sure.
@krccmsitp2884
@krccmsitp2884 2 ай бұрын
Amazing! Thanks to both of you! 🙂
@Hereson
@Hereson 2 ай бұрын
Amazing explanation, please do more of these!
@danielvillalba4457
@danielvillalba4457 2 ай бұрын
Wow, just amazing information and even better way to explain it! Thanks
@DotNetRyanYT
@DotNetRyanYT 2 ай бұрын
Thanks for this. Async/await was always a black box to me, but now I feel I have lifted the lid on the box and took a look inside.
@emiraksoy1520
@emiraksoy1520 2 ай бұрын
This was amazing we want more content with Steve 💯💯
@stevanfreeborn
@stevanfreeborn 2 ай бұрын
Thank you for making this! 🙏🏻
@v001
@v001 2 ай бұрын
Stephen Toub is a legend! great talk, need more of this
@danfriedman7009
@danfriedman7009 Ай бұрын
Immensely helpful. You guys rocked this presentation. Can't wait to watch the LINQ videos (and I hope there is more on the way).
@SharpGIS
@SharpGIS 2 ай бұрын
Loved this. Please do more Level 3-400 content!
@damianpio1443
@damianpio1443 2 ай бұрын
Loved this video, hope we will get more of these
@RickJohnn
@RickJohnn 2 ай бұрын
Excellent from start to finish.
@thedanielspindler
@thedanielspindler 2 ай бұрын
Loved this. Amazing! Now I just need to re-watch it another 5 times at 0.5 speed to really soak it all in.
@jmbrjmbr2397
@jmbrjmbr2397 19 күн бұрын
Very interesting and enlightening lecture. Thank you for your efforts.
@sjark5000
@sjark5000 Ай бұрын
This is just fantastic content, more of this please :)
@sudeshryan8707
@sudeshryan8707 2 ай бұрын
This is gem of a tutorial. Thanks guys
@michaltomorowicz596
@michaltomorowicz596 2 ай бұрын
What a great material guys, massive kudos.
@KenRossPhotography
@KenRossPhotography 2 ай бұрын
Awesome video - so many great nuggets here. Even if you think you *know* async/await, you'll get value from watching this (maybe more than once) 🙂
@papafe
@papafe 2 ай бұрын
Super interesting! I think it would be interesting also to dive deep into SynchronizationContext and how it relates to the ExecutionContext that was shown in the video
@MatteoGariglio
@MatteoGariglio Ай бұрын
I wish I watched this video long time ago 😅. Thank you so much Stephen, the explanations are really instructive.
@theFoodieCyclist
@theFoodieCyclist 2 ай бұрын
Loved it! You guys are awesome!
@draganradovac8803
@draganradovac8803 21 күн бұрын
I was going to skip this one thinking it would be the "same old" about async/await. Boy was I wrong. That was amazing. Thank guys.
@thishandleistaken
@thishandleistaken 2 ай бұрын
Amazing video! Thanks!
@stephajn
@stephajn 2 ай бұрын
Like Admiral Kirk said to Saavik in Wrath of Khan, “You have to know WHY things work on a starship.” This was definitely really cool to watch and follow! Gonna have to watch it again on a PC as opposed to my iPad, but it is well worth it!
@SajadJalilian
@SajadJalilian 2 ай бұрын
We really need Stephen do more live coding. He is really good at delivering what he does
@wolfgangdiemer2511
@wolfgangdiemer2511 2 ай бұрын
Thank you very much, awesome content
@BryanKelly
@BryanKelly Ай бұрын
First, I loved this video. Just everything about it was good. I would love a follow up to cover: 1. more of the async/await keywords (the stuff you were getting to at the very end) 2. Why doing the "bad" things is bad. (ex. .Result, and others I'm failing to think of now) 3. Async enumerable
@chenc671
@chenc671 2 ай бұрын
Wow, It was a Master piece when the await works at the end !
@zakizaz1
@zakizaz1 2 ай бұрын
Great content . Thank you
@unknown.artist.track3
@unknown.artist.track3 Ай бұрын
I had already bookmarked your article from dev blog about async await)))
@user-we2gj9uz7r
@user-we2gj9uz7r 2 ай бұрын
Excellent content! Thank you!
@robl39
@robl39 2 ай бұрын
Now get David Fowler to write Kestrel from scratch. I’d love to see that.
@paulecampbell
@paulecampbell 2 ай бұрын
Stephen is on another level!
@n8wrl
@n8wrl 3 күн бұрын
You guys rock! So helpful, thank you!!
@northshorepx
@northshorepx Ай бұрын
That was a really great tutorial. Seeing how everything is continuations all the way down was incredibly eye opening. I'd love to see more details like this please. However I have one small nitpick, that of Stephen constantly making the font way too small to read. Scott kept picking him up on it, but it's really important for us who are watching to be able the read the code that they're writing and thus for presenters to realise how video tutorials need zoomed up fonts.
@azarthi
@azarthi 2 ай бұрын
Love this super easy to follow!
@jackkendall6420
@jackkendall6420 2 ай бұрын
This was incredibly good.
@JSWarcrimes
@JSWarcrimes 2 ай бұрын
Now this is some premium content.
@rasmussoeborg450
@rasmussoeborg450 2 ай бұрын
Very informative - Great explanation
@rafaelfelipe3986
@rafaelfelipe3986 2 ай бұрын
Amazing content. Thank you so much for that.
@timeless-sg
@timeless-sg 2 ай бұрын
EXCELLENT. THANK YOU STEPHEN.
@zeleps
@zeleps 2 ай бұрын
Great video, as always! I have one question though, why the lock() @30:14? _completed is a boolean value, reading it is an atomic operation, lock does not guarantee anything at this point. Or does it?
@jimiscott
@jimiscott 2 ай бұрын
This is superb.
@aptypp
@aptypp 2 ай бұрын
Thanks for video!
@semihartan
@semihartan 2 ай бұрын
Amazing presentation. Thank you both!
@LILogisticaIntegrada
@LILogisticaIntegrada 2 ай бұрын
Thanks for this!
@karthiks4347
@karthiks4347 Ай бұрын
Simply great!!👍
@PhoenixCustomerInsights
@PhoenixCustomerInsights 2 ай бұрын
I would love to strive for that clarity of knowledge in tasks. I'm holding on to this video for another review and letting it wash over me a few times. Could there be a continuation in the parallel processing of tasks, comparing concurrency and parallel execution of Tasks?
@AslamNazeerShaikh
@AslamNazeerShaikh 2 ай бұрын
Please make videos on "cancellation token"
@sachinvshishth
@sachinvshishth 2 ай бұрын
Thank you for the insightful session. Just a quick request: could you please utilize the dark theme whenever feasible?
@obinnaokafor6252
@obinnaokafor6252 2 ай бұрын
Scott and Stephen should do videos on Tensor Primitives in dotnet. And other ML types and improvements in dotnet and C#
@shanselman
@shanselman 2 ай бұрын
Totally!
@giovannimorleschi1750
@giovannimorleschi1750 Ай бұрын
Awesom, semply awesom, you have to do a lot of this video please! Stephen Tuob, you are ten thousand time better then the better professor in tis solar system!
@shadowspyes
@shadowspyes 2 ай бұрын
please more high detail low level videos like this!
@Rolan18111
@Rolan18111 2 ай бұрын
Excellent video - that certainly removed a lof of the "ghosts in the machine" feel of async/await. I feel like de-implementing syntactic sugar would be another good video topic. Take some modern c# code and replace all the syntactic sugar with the underlying implementations. And/Or show how you can look up the underlying implementations quickly & easily.
@MatPolutta
@MatPolutta 2 ай бұрын
I needed this. Thanks
@MatPolutta
@MatPolutta Ай бұрын
Just watched a 2nd time. Almost there. 3rd time is the charm? Let's hope.
@tiZyJoshi
@tiZyJoshi 2 ай бұрын
this was awesome, ty!
@tarsala1995
@tarsala1995 2 ай бұрын
Great video. What do you think of going through the implementation of basic GC with Stephen Toub?
@dealsman
@dealsman Ай бұрын
Intense! Both of you!
@DOTNETMAN
@DOTNETMAN 2 ай бұрын
The Legends of .NET.
@tarun-hacker
@tarun-hacker 2 ай бұрын
Stephen Toub is awesome.
@tedchirvasiu
@tedchirvasiu 2 ай бұрын
Wow, just as I needed this
Deep Dive on LINQ with Stephen Toub
1:23:59
dotnet
Рет қаралды 51 М.
We Got Expelled From Scholl After This...
00:10
Jojo Sim
Рет қаралды 35 МЛН
Would you like a delicious big mooncake? #shorts#Mooncake #China #Chinesefood
00:30
Чай будешь? #чайбудешь
00:14
ПАРОДИИ НА ИЗВЕСТНЫЕ ТРЕКИ
Рет қаралды 2,9 МЛН
FOOLED THE GUARD🤢
00:54
INO
Рет қаралды 9 МЛН
Await Async Tasks Are Getting Awesome in .NET 9!
9:24
Nick Chapsas
Рет қаралды 87 М.
Full stack web UI with Blazor in .NET 8 | .NET Conf 2023
55:56
"Highly Technical Talk" with Hanselman and Toub | BRK194
46:11
Microsoft Developer
Рет қаралды 30 М.
Working with Channels in .NET
27:41
dotnet
Рет қаралды 30 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 987 М.
A Complete .NET Developer's Guide to Span with Stephen Toub
1:02:48
Back to Basics: Efficient Async and Await - Filip Ekberg - NDC Oslo 2023
1:01:25
"Stop Using Async Await in .NET to Save Threads" | Code Cop #018
14:05
That's NOT How Async And Await Works in .NET!
12:25
Codewrinkles
Рет қаралды 15 М.
📦Он вам не медведь! Обзор FlyingBear S1
18:26
How charged your battery?
0:14
V.A. show / Магика
Рет қаралды 5 МЛН
Samsung S24 Ultra professional shooting kit #shorts
0:12
Photographer Army
Рет қаралды 18 МЛН
Mem VPN - в Apple Store
0:30
AndroHack
Рет қаралды 103 М.