Using your definition at around 17:15, threads are contained in the same process as the main thread, and therefore are run on the same core. I think the overall explanation was good but in order for multiple tasks to occur on different cores, you need separate processes, not threads. Threads are also context switching, but the specifics of when to join the threads, etc. is done manually whereas async/await is done for you by the language.
I have a doubt that even if multiple threads are running on a same core through thread interleaving then it will concurrent programming and not parallel programming right? So is multi-threading not always parallel programming?
@@rahulk2573 yes, multi-threading is not always done in parallel. I believe if you have a multicore CPU, most OS' schedulers are able to correctly dispatch different threads to different cores. For CPUs with 1 core, they are still able to perform tasks concurrently via thread interleaving like you correctly pointed out.
Need to quantify the two tasks. How much time for T1 and T2? For example, T1=5; T2=10. Think of multiple sentences to a prisoner. In (A) "Consecutive" (not shown here) 5, then 10 = 15. (B) Concurrency to a prisoner means both at same time. But here, both T1 and T2 must finish in same total time (5 + 10) (not good for prisoner), but maybe one or two at a time. In (C) Parallel means maximum time of all tasks is required (10). The difference is how attention is given to each task. In A and C, full attention to each, but in C it's to both. In B attention is toggled so both tasks "feel" they're getting full attention (@2:23), important for user.
Nice Explanation At 11:44 if instead of placing debugger on LINE17 place it at LINE13 and debug through code and observe the threads, see multiple threads as in case of parallelism. It appears async await use multiple threading in background but if its using multiple threads then why they need context switching?
So I have question after looking into this video. Is Async & Await coming under concurrency? That's what I understood after looking at the Threads in debug mode.
Hi, As mentioned if async and await doesn't use threads then i have a doubt, I have created 2 async methods which are having some 20secs of code (as an example task.delay(20seconds)) and i have called them one after the other. If async concept doesn't use threads and if it only uses context switch then i think in order to run my code and show me the result it shoud take 40seconds ideally. But when i tried, it is taking only 20sec and gives me correct and expected output. Could you please clarify the doubt and do correct me if i am missing anything. Thanks in advance.
you are right async and await are not just context switching, It is about multi theading as well. if you want to know more detail about this o'really media has very good on async and await.
I hope I am not late. It's case of multithreading. He mentions in video about context swapping that only happens if no more multithread is available. For example, I have 2 core CPU and it has multithreading enabled. That means, I have generally speaking 4 core. So, when u use async, it is as it is working in different thread hence u see 20 sec. But suppose, I have 1 core CPU no multicore or multithreading. That's means all tasks has to perform in same thread. Hence, context swapping or time slicing. In this case, there is no benefit of using async other than responsive.
@@AB-cn5hb In simpler words, threads basically does work on the same 'Worker thread' but if we use 2 tasks then it will use two different 'worker thread'. Correct me if I'm wrong.
So as a consequence at the end of the computation, running our processes in series or concurrently is in terms of total time speed equivalent ? This is just a matter of perception.
I want to understand here that you created 2 worker threads: NewMethod() and NewMethod1() and there is one main thread means total 3 but here in the debug there are 3 worker threads and one main thread means total 4 threads so why there is one extra worker thread created for?
30 Important C# Interview Questions : th-cam.com/video/BKynEBPqiIM/w-d-xo.html
Software Architecture Interview Questions : th-cam.com/video/AtTgcbLOqMM/w-d-xo.html
25+ OOPS Interview Questions : th-cam.com/video/u99wAoBjDvQ/w-d-xo.html
20+ SQL Server Interview Questions : th-cam.com/video/SEdAF8mSKS4/w-d-xo.html
10+ Power BI Interview Questions : th-cam.com/video/Cozc9WNBRt4/w-d-xo.html
20 MSBI Interview Questions : th-cam.com/video/Nw_sHEKnOUE/w-d-xo.html
SQL Server Joins : th-cam.com/video/KTvYHEntvn8/w-d-xo.html
SQL Step by Step - th-cam.com/video/uGlfP9o7kmY/w-d-xo.html
Angular Step by Step Tutorial for Beginners : th-cam.com/video/-9VcW7MBDs8/w-d-xo.html
25 Angular Interview Questions : th-cam.com/video/-jeoyDJDsSM/w-d-xo.html
25 Important ASP.NET Interview Questions : th-cam.com/video/pXmMdmJUC0g/w-d-xo.html
35 Important JavaScript Interview Questions : th-cam.com/video/Zb4dPi7CANU/w-d-xo.html
20 MySQL Interview Questions : th-cam.com/video/9hfjC-BpY20/w-d-xo.html
5 MSBI Interview Questions : th-cam.com/video/5E815aXAwYQ/w-d-xo.html
20 PHP Interview Questions : th-cam.com/video/1bpNSynUrl8/w-d-xo.html
Sirji you are from a different planet. Awesome master piece.
Kya kehna chahta hai bhai 😂
One of the best teachers I ever came across ! Thank you sir, you are amazing
Using your definition at around 17:15, threads are contained in the same process as the main thread, and therefore are run on the same core. I think the overall explanation was good but in order for multiple tasks to occur on different cores, you need separate processes, not threads. Threads are also context switching, but the specifics of when to join the threads, etc. is done manually whereas async/await is done for you by the language.
I have a doubt that even if multiple threads are running on a same core through thread interleaving then it will concurrent programming and not parallel programming right?
So is multi-threading not always parallel programming?
@@rahulk2573 yes, multi-threading is not always done in parallel. I believe if you have a multicore CPU, most OS' schedulers are able to correctly dispatch different threads to different cores. For CPUs with 1 core, they are still able to perform tasks concurrently via thread interleaving like you correctly pointed out.
Need to quantify the two tasks. How much time for T1 and T2? For example, T1=5; T2=10. Think of multiple sentences to a prisoner. In (A) "Consecutive" (not shown here) 5, then 10 = 15. (B) Concurrency to a prisoner means both at same time. But here, both T1 and T2 must finish in same total time (5 + 10) (not good for prisoner), but maybe one or two at a time. In (C) Parallel means maximum time of all tasks is required (10). The difference is how attention is given to each task. In A and C, full attention to each, but in C it's to both. In B attention is toggled so both tasks "feel" they're getting full attention (@2:23), important for user.
The best explanation of those concepts I have found on TH-cam! 10/10!
Great job, I searched more than 20 videos for sure , to get a confident view on this.. you did it . Great job!!! Thank you!
the explanation is so detail and easy to understand, thanks for your hardwork
what an amazing video! great work and very glad to be able to understand these concepts as I have always somewhat struggled with these
Thanks for teaching like we're dummies. I can't express how much I appreciate your teaching style.
Really Impressive... Thank you for making me clear about these concepts.
Excellent tutorial with fundamental points clearly and concisely explained.
Thank you so much!
One of the best tutorial i have ever found thank you so much hope you will upload more updates video about c#.
Last images summarizes the whole lecture :)
Great One, helped me building parallel core app in unity.
Nice Explanation
At 11:44 if instead of placing debugger on LINE17 place it at LINE13
and debug through code and observe the threads, see multiple threads as in case of parallelism.
It appears async await use multiple threading in background but if its using multiple threads then
why they need context switching?
I love those explanations. Thanks for your hard work!
This is the best lecture on these topics 👍
So I have question after looking into this video. Is Async & Await coming under concurrency? That's what I understood after looking at the Threads in debug mode.
I am a big fan of you sir. What a knowledge you have sir. Thanks a lot for such tutorials.
Hi, when you said that threads were not created, because you didn't want to run parallely, but threads can run concurrently as well, right?
To the point with lucid explanation ... hats off sir ji
Explained very well now I must say I am theoretically clear on concurrency and parallism
This has cleared up a lot of confusion for me.
Hi, As mentioned if async and await doesn't use threads then i have a doubt, I have created 2 async methods which are having some 20secs of code (as an example task.delay(20seconds)) and i have called them one after the other. If async concept doesn't use threads and if it only uses context switch then i think in order to run my code and show me the result it shoud take 40seconds ideally. But when i tried, it is taking only 20sec and gives me correct and expected output. Could you please clarify the doubt and do correct me if i am missing anything. Thanks in advance.
you are right async and await are not just context switching, It is about multi theading as well. if you want to know more detail about this o'really media has very good on async and await.
I hope I am not late. It's case of multithreading. He mentions in video about context swapping that only happens if no more multithread is available. For example, I have 2 core CPU and it has multithreading enabled. That means, I have generally speaking 4 core. So, when u use async, it is as it is working in different thread hence u see 20 sec. But suppose, I have 1 core CPU no multicore or multithreading. That's means all tasks has to perform in same thread. Hence, context swapping or time slicing. In this case, there is no benefit of using async other than responsive.
@@AB-cn5hb In simpler words, threads basically does work on the same 'Worker thread' but if we use 2 tasks then it will use two different 'worker thread'. Correct me if I'm wrong.
Last picture was just awesome and make really sense :)
Good explanation. I think at 14:50 the word is "undeterministic".
Very helpful and easily explained, thanks again
Very well explained. Thank You Shiv
Thank You :)
Since one core can have multiple threads, is performing different tasks on different threads of the same core parallelism?
Valeu!
@Edipo G Thank you for your contribution; it will encourage us to create more useful content.
Happy learning....!
Thank you for this wonderful Tutorial.
So as a consequence at the end of the computation, running our processes in series or concurrently is in terms of total time speed equivalent ? This is just a matter of perception.
Wonderful explanation. Just a small correction: Instead of determistic, it should be deterministic. Other than that, excellent content.
I am big fan of your teaching 💕
Great job. Very clear.
Such a great explanation. Thank you sir.
Thank you! Very well explained!
Your are really producing good content sir
Why does it show no threads running for me? 11:05
Async have .configuration(false or true) in their calling level . That is helpful for performance ?
Very nicely explained :)
You are the real MVP.
You are a Gem. Thanks!
You are the Real Rocks Sir 🙏🙏🙏
Beautiful explanation!!
Superb explanation!
Good video! One quick tip: 'deterministic' is correct spelling and not 'determistic'.
Super impressive. Excellent 🙏
I want to understand here that you created 2 worker threads: NewMethod() and NewMethod1() and there is one main thread means total 3 but here in the debug there are 3 worker threads and one main thread means total 4 threads so why there is one extra worker thread created for?
I have never found anyone who can explain better then Shiv Prasad Koirala Sir
was really clear and concise....thanks
Very nice explaination ur video better than udmey videos
Nicely explained!
Nice explanation Sir
Shiv sir - Can I use concurrency and parallelism both at once as I need performance as well as usage both at a time🤔
If u use parallelism u have the non blocking aspect included so.
Thank you for the video, really nice work.
sirji please make a video on Dependency inject in c#
great video !!
the threads do not appear in my thread panel, does any one know why?
Thank you so much..... Thanks alot for sharing such a wonderful stuff
great work mate, thank you!
thanks. very useful
very good explanation tho !!!
Great!! thanks for sharing
Now i understood after so many articles and videos.
superbbb!!!!!!!!
Nailed it!!!
You just cracked something i was worried about for many days..when are u going to release the second part?
Its here th-cam.com/video/G3tz9rxts8E/w-d-xo.html
really good
Beautiful!!!!!!
Tx sir
IT developers. This is such a interesting name.
Nice
👍👍
omg i can finally found an indian acent that i could understand
do not know, how many times i have watched
not working
It looks like you are confusing concurency with asynchronism
Do put more explanation.
Imagine juggling with computers!!
as to his accent, of course it's indian
Excellent explanation. Thank you 🙏.
Nice explanation!