Hi Frank Liu, Thanks alot for the video. However I have a little question. Is there any difference in parallel vs async programming? If yes, then is this tutorial is for Parallel Programming or is it about async programming?
@FrankLiuSoftware4 жыл бұрын
Hi Shahid, that is a great question! I am not sure if I can explain clearly in a comment, but I will try. To understand what asych is, the easiest way is to think about what synch is: task1, task 2 and task 3 have to run in sequence in other words, they have to run synchronously. Whereas, if task 2 runs before task 1finishes, we call it asynchronous. Here, we are emphasizing the order of executing. Then what is parallelism? Obviously, when two tasks are running at the same time, we say they are running in parallel. Here, we are not emphasizing the sequence, but that there are multiple activities at the same time. However, if you think deeper. In asynchronous programming, there have to be at least two tasks, the main task carried on by the main thread, and the long running task. The task is not blocking nthr the main task because they are running in parallel. So, they are essentially very closely related. Hence, I say that the difference between the two is in emphasis. One is empathizing the order of execution can go out of sync, the other is emphasizing two or more tasks can run at the same time. Because the emphasis is different, the problems the two are trying to resolve are different too. Asynchronous tries to resolve how to continue after the long running task, whereas Parallelism tries to resolve sharing resources/messages between the threads. This tutorial is more about async and less about parallelism because it deals more with how to continue after a long running task. However the two topics are closely related. I hope that helps.
@sriaz814 жыл бұрын
@@FrankLiuSoftware Thanks for the detailed answer. As per my knowledge, in async model, order of execution does not matter. It deals the problem of freezing or waiting when a long running task is executing itself. When we use await keyword, we are saying hey task please execute urself and when u r executing urself, give me the control back so that i can work on other things. So in this case time is switched b/w them for execution (they are not executing at the same time). When.long running task get completed it signals the main calling method that I am done. In case if we are doing async programming using task.run, then it pickup thread from thread pool to execute the task. While in parallel programming model, threads are created to execute the code and they all run in parallel
@FrankLiuSoftware4 жыл бұрын
@@sriaz81 Yes Shahid, you are correct. I worded it in a confusing way. What I meant by "the order of executing" is that after the long running process finishes, something needs to be executed. I was referring to the call back process. With task.run, we have to specify a call back, yet with async and await, we achieve the same result without specifying a call back function. Parallel programming has multi threads run at the same time (same as async), but here we are mainly trying to resolve the shared resources problem: how can the multi threads access the same resource without causing conflicts.
@rajesh35hsp3 жыл бұрын
async programming means long time taking tasks like getting input from user or reading from db, but not CPU intensive. While if you think of parallel programming it will be like doing some CPU intensive work processing millions of records.
@himanibhatnagar7439 Жыл бұрын
@@FrankLiuSoftware easiest explanation.. thanks
@Jonathan-bn8hb4 жыл бұрын
This is the clearest explanation video about asynchronous programming I've encountered. Thank you very much. You deserve a lot more subscribers. Keeps doing your thing man.
@expertreviews11122 жыл бұрын
It means you haven’t seen enough videos
@os-channel4 жыл бұрын
Great job, never saw a better tutorial concerning basics of Tasks
@kopilkaiser8991 Жыл бұрын
You are absolutely brilliant. Months and browsing endlessly, you had finally made me understand the Task asynchronous topic. You earned a gold medal from me🎉
@NoOne-wf6hm3 жыл бұрын
Best video on KZbin regarding Tasks for beginners. I still have to dig more into this until it makes absolute sense. Anyways: Thanks Frank.
@FrankLiuSoftware3 жыл бұрын
Glad it was helpful!
@一江春水向东流-y6q3 жыл бұрын
this is really the best tutorial about async await c# for its simplicity and clearness i ever see, after reading so many microsoft documentation, i am still confused, now you save my ass, Thank you.
@eprice0009 ай бұрын
Thanks for breaking it down in such an easy to understand way!
@andrewrayanit2 жыл бұрын
Thanks man. Sat late night and have given us great tutorial.
@julianocs87 Жыл бұрын
Clear, concise explanation. Great video.
@naveenraj750311 ай бұрын
Thanks Frank for giving a detailed explanation.
@adhivenkatesh34313 жыл бұрын
Hi Frank , Frankly telling its clean and very clear video , thanks for your effort and sharing to others.
@FrankLiuSoftware3 жыл бұрын
You are welcome Adhi!
@kasuntkarunarathne2 жыл бұрын
Thank you so much. Great explanation of Tasks, Async and await.
@cicbeats29564 жыл бұрын
I consider myself as a slow learner, but this helped alot. THANK YOU!
@FrankLiuSoftware4 жыл бұрын
Glad that it is helpful!
@satishbhuktar20202 жыл бұрын
How your awaiter.GetResult( ) is providing value.. it's return type is void.??.
@salaheddineelkhalifa87623 жыл бұрын
Hello Man, You saved my Day you nailed it. Many thanks !
@FrankLiuSoftware3 жыл бұрын
Glad that it is helpful!
@marlonbraga2 жыл бұрын
Thanks Liu. This video help me so much
@LesibaPhokela4 жыл бұрын
Thank you Frank, you gave a best example ever.
@Nicetrycutiepie3 жыл бұрын
best explanantion and clean and simple to understand,, i just liked it very well...
@cloudguy41923 жыл бұрын
Thank you for posting the video!
@FrankLiuSoftware3 жыл бұрын
Thank you for watching!
@ukii2613 жыл бұрын
Thanks a bunch! Helped me out a lot.
@vindjedouatchomba77423 жыл бұрын
Thanks Frank Liu!! Great tutorial!
@FrankLiuSoftware3 жыл бұрын
You are welcome!
@jimbroiles69052 жыл бұрын
Thank you for the clear explanation of the basics of asynchronous programming. I appreciate the way you that start with the basic concept and use very simple examples. Then additional concepts build on top off the previous ones, which builds our understanding step by step. It is an excellent approach to teaching. I learned everything I need to clear my understanding and go forward with correct implementations of asynchronous programming in C#. Many other tutorials on this topic should stop and learn from this one. Focus on teaching the concepts and implementation in simple, clear terms and quit trying to show how good you are at writing code. Many of us get lost in the complexity code you are trying to use as an example. It is a waste of time because the example is too hard to follow (Tim Corey please pay attention). I look forward to viewing more of your content. Subscribed.
@olgaliuft56074 жыл бұрын
You are a great teacher! Thank you for sharing these videos
@FrankLiuSoftware4 жыл бұрын
Thank you Olga!
@jayronthompson2562 Жыл бұрын
This is an amazing explanation.
@MasoudSamimi4 жыл бұрын
you are great teacher , it was so clear
@FrankLiuSoftware4 жыл бұрын
Thank you so much!
@hiderr68055 жыл бұрын
Thank you man! You definateely need more subscribers huh (EDIT: For a moment at the begining i thought it's a joke (those houses lol))
@FrankLiuSoftware5 жыл бұрын
C# in a home buyer's mind. LOL!
@hiderr68055 жыл бұрын
@@FrankLiuSoftware lol
@hiderr68055 жыл бұрын
@@FrankLiuSoftware xD
@tamilstudent14 жыл бұрын
Such a calm explanation. Thanks.
@arborinfelix2 жыл бұрын
This was a real good and clear tutorial.
@trustingod09 ай бұрын
Hi Frank Liu, Thanks alot for the video. However I have a little question. What is the difference between Concurrency and Asynchronous?
@FrankLiuSoftware9 ай бұрын
Check out my answer here: frankliucs.com/async-vs-parallelism-in-c
@trustingod09 ай бұрын
@@FrankLiuSoftware Appreciate you putting the link for additional clarity. But I still don’t understand why we have all of these wonderful ways of making a Task run asynchronously with the ability to await other tasks until they are finished but I can’t think of any use cases where this is applicable except for database and file operations.
@akshaydubey.57.a7515 күн бұрын
thanks for this short & sweet
@amolpawale16573 жыл бұрын
Very well explained. 🔥🔥🔥🔥
@bioanu3 жыл бұрын
What is the reason you introduce the last function Test? I run the example using static async Task Calculate1_2() directly and the result is the same as using Test function.. What is the difference? Why do you introduce so many functions?
@Nicetrycutiepie3 жыл бұрын
just brilliant explanation bro cheers.
@ЄгорШамрай4 жыл бұрын
Thanks for lesson!Can you make more videos about asynchronous programming or concurrency in C#?
@FrankLiuSoftware4 жыл бұрын
It was my plan to do a series of that. But I am still planning. Not sure which one will go next.
@santoshmandal68052 жыл бұрын
Awesome............Well structured examples.
@hardikbhatt6976 Жыл бұрын
Very very nice explanation
@Samuel-lm1wb7 ай бұрын
Awesome work! Thank you
@niroshanmanoharan42954 жыл бұрын
Thank you very much for your simple and clear explanation. May God Bless you!
@FrankLiuSoftware4 жыл бұрын
Thank you sir! May God bless you too!
@nmarks2 жыл бұрын
Beautiful explanation.
@BitcoinBabu3694 жыл бұрын
Simply superb explanation. 🙏
@FrankLiuSoftware4 жыл бұрын
Glad that it helps.
@242hiran4 жыл бұрын
Very calm and clear explanation. Thank you indeed Frank #maestro
@ofercarmeli65085 жыл бұрын
Very good demo. Thanks!!!
@kanhamunjal7594 жыл бұрын
Very well explained. Thank you Frank !
@FrankLiuSoftware4 жыл бұрын
You are very welcome!
@MrSK1682 жыл бұрын
Thanks for sharing!!!
@EraZz1874 жыл бұрын
very good and clear explanation !!!
@FrankLiuSoftware4 жыл бұрын
Thank you Eraz!
@shuvbhowmickbestin2 жыл бұрын
what's a GetAwaiter()
@ma88922 жыл бұрын
Hi Frank Liu. Nice Video :). In the end you are creating a Test() - method with "async static void Test()". Is this a misstake? Since the general advice is to avoid "async void" for async methods, other than for event handlers.
@alijohn198 Жыл бұрын
love this video ❤
@ramganapathy32983 жыл бұрын
Nice video. However, in your Calculate1_2 () method, you have the method signature as, "async static void Calculate1_2 ()". It will cause deadlocks. Instead, it should be, "async static Task Calculate1_2 ()".
@FrankLiuSoftware3 жыл бұрын
That is correct. It is correct to use Task. KZbin doesn't allow you to fix a video once it is uploaded.
@avectresormt3 жыл бұрын
clean explaination
@robiesun37134 жыл бұрын
You helped me a lot. thanks for this video :)
@FrankLiuSoftware4 жыл бұрын
You are very welcome!
@Ramboo3394 жыл бұрын
Do you have an example with web api?
@FrankLiuSoftware4 жыл бұрын
What exactly you want to see about web api? I am planning my tutorials, you are welcome to give suggestions! Thanks!
@Ramboo3394 жыл бұрын
Using Asynchronous and synchronous methods for a web api weather app or news feed app for example
@FrankLiuSoftware4 жыл бұрын
Let me think about it! Thank you so much!
@UrvishKathiriya4 жыл бұрын
@@FrankLiuSoftware Yes, I'd love to see that. A video on Web API async await will help a lot. Thanks. :-)
@mdabuzar21304 жыл бұрын
Hi Frank, hope you are doing great. Could you please help me on how to process thousands of records in c#. Each record call a service to get some other details based on record id. Currently I am using paralell.foreach and it process 10000 record in an hour. Please suggest me how can I improve performance by 50%.
@FrankLiuSoftware4 жыл бұрын
Hi Md, the method you shall use depends on many factors. For example, the nature of the records you are processing, the way you are processing each record... I would do lots of comparisons and profiling. Have you tried without parallelism? How much time did that take? Have you tried partitioning the data before you do the parallel foreach? Just in case, don't forget to see if there are ways to improve the processing of each record.
@jorgesolano70605 жыл бұрын
Nice video man, thanks!!
@raunaksingh60505 жыл бұрын
thanks a lot, please upload more...
@markprescher4 жыл бұрын
Great video!
@FrankLiuSoftware4 жыл бұрын
Thank you Mark!
@anandtiwari47233 жыл бұрын
thanks for this wonderful video :)
@FrankLiuSoftware3 жыл бұрын
You are welcome!
@watchaccount4 жыл бұрын
You did not exaplain the last part. changing return value to Task.
@leozhang13404 жыл бұрын
讲得好!优秀👍👍
@FrankLiuSoftware4 жыл бұрын
谢谢!很高兴帮助到你!
@一江春水向东流-y6q3 жыл бұрын
@@FrankLiuSoftware 技术很棒,英文说的也非常美式,我几乎听不出你的口音
@zaffarullah_bhutto4 жыл бұрын
Thank you man
@FrankLiuSoftware4 жыл бұрын
You are welcome!
@poojanaidu23963 жыл бұрын
Screen is not clear
@fredrikterent86975 жыл бұрын
Great!
@FrankLiuSoftware4 жыл бұрын
Thank you!
@yz20394 жыл бұрын
Thank you! Xiexie
@FrankLiuSoftware4 жыл бұрын
不客气!
@БориславБорисов-я2ы5 жыл бұрын
Clearly!
@anushaaladakatti41454 жыл бұрын
Good explanation, could have been a little faster
@VarunKumar-qd5wl4 жыл бұрын
en le Aladakatii, Heng idi?
@FuzzyDPozzy4 жыл бұрын
9.32 was the reason i quit the tutorial. you should have kept it simple
@FrankLiuSoftware4 жыл бұрын
Thank you! I like constructive comments! Appreciated!