Tartan House Canada

The Art Of Weaving

Menu
  • Curation Policy
Menu
What is TPL ( Task Parallel Library) and how it differs from threads (c# interview questions) ?

What is TPL ( Task Parallel Library) and how it differs from threads (c# interview questions) ?

Posted on November 20, 2019 by John Hardy

Related posts:

  1. c# (Csharp) and .NET :- Multithreading and thread safe objects.
  2. c# (Csharp) threading interview question:- What is thread,background thread and foreground thread ?
  3. How to Keep you Applique and Quilting Squares Wrinkle Free
  4. How to Do a Bob & Weave Squat | Thighs Workout

51 thoughts on “What is TPL ( Task Parallel Library) and how it differs from threads (c# interview questions) ?”

  1. Fortwuny says:
    June 17, 2013 at 12:45 pm

    thank you for this explanation!!!!

    Reply
  2. suraj httreb says:
    June 17, 2013 at 1:14 pm

    Its a dope video awesome.

    Reply
  3. jasraj29 says:
    June 17, 2013 at 4:02 pm

    awesome..

    Reply
  4. Meenakshi Sekar says:
    June 19, 2013 at 5:58 am

    not able to access this video. it says an error occurred

    Reply
  5. 8uddishh says:
    June 21, 2013 at 3:10 pm

    you should have put the parallel for inside the run million iterations… technically you are showing two diff examples…..

    Reply
  6. .NET Interview Preparation videos says:
    June 22, 2013 at 12:22 pm

    You are so right. But well the TPL example was super loaded
    with 1 million time more but still performed better. So it sill conveys the same message TPL is better.

    So sorry i was so engrossed in the demo……Should avoid night recordings.

    Reply
  7. umesh kumar says:
    June 26, 2013 at 5:05 pm

    thank you for this explanation!!!!

    Reply
  8. Nat Maddox says:
    July 10, 2013 at 12:22 pm

    Hi, Great video, where are the other parts to it?

    Reply
  9. Nitin Reddy says:
    August 23, 2013 at 7:27 am

    "P2" is typically used to refer to the "Pentium 2" processor. A processor with 2 cores is referred to as a "dual core" processor and a system with 2 processors is referred to as a "dual processor" system (a dual processor system can have more than 2 cores).

    Reply
  10. Nitin Reddy says:
    August 23, 2013 at 7:30 am

    To increase utilization, you should create multiple threads. As you have 4 cores, creating 4 threads with each running the RunMillionIterations would show you a high CPU utilization.

    Reply
  11. Nitin Reddy says:
    August 23, 2013 at 7:34 am

    It plays for me. Must have been just a YouTube error.

    Reply
  12. shootdaj says:
    October 6, 2013 at 7:27 pm

    Where is the 2nd part of this video? I cannot seem to find a link for it. Thanks.

    Reply
  13. PrasadS says:
    January 15, 2014 at 10:58 pm

    examples show are different but proves the point anyways that TPL has better performance than threads.

    Reply
  14. PakredBoz says:
    February 22, 2014 at 11:42 pm

    Good video showing concept of TPL but in this example diagram showing running multiple cores of 1/2 millions iterations each but code shows running multi cores of millions iterations which I don't quite follows. How do you knows that tasks of computing spread equally.

    Reply
  15. Ajesh Mahto says:
    February 24, 2014 at 8:15 am

    how to implement, below code using TPL. Any Idea?

    foreach (GridViewRow row in grdSearch.Rows)
                { //do smth
    }

    Reply
  16. Gaurav Tarey says:
    April 10, 2014 at 3:55 pm

    P8, hehehe :p

    Reply
  17. Anupam Singh says:
    May 1, 2014 at 1:58 pm

    You are awesome sir.. really you always explain complex things in simple way. that a layman can understand..  thank you for sharing ..

    Reply
  18. Kees says:
    June 19, 2014 at 3:53 pm

    thank you for this great video, very well done!

    Reply
  19. chayan kar says:
    July 3, 2014 at 6:27 am

    good tutorial .. liked it !!

    Reply
  20. vbansal1984 says:
    July 26, 2014 at 1:10 pm

    awesome. love the explanation of all your videos.

    Reply
  21. Mahesh Kotekar says:
    August 7, 2014 at 4:01 pm

    Correct me if am wrong, Parallel.For runs  from 0 to million each time it calls a function RunMillionIterations(). This means that the each function call will be divided among processors/ available threads. However, i see the explanation saying the whole iteration is divided among iteration that is kind of confusing. 

    Reply
  22. Himanshu Jain says:
    August 8, 2014 at 12:48 pm

    I think we do not need "for loop" in the method while we are using parallel class in the example mentioned in the video..   

    Reply
  23. Gul Rochlani says:
    August 30, 2014 at 11:42 am

    Author seems to be under impression that PII processor means processor have two cores. Rather PI to PIV are all single core processors, only after arrival of dual core pentiums we had multiple cores and later it was followed by core 2, I3,I5,I7.

    Reply
  24. Cedric Reinsch says:
    November 1, 2014 at 5:45 pm

    After inserting the Parallel.For-Call the total amount of iterations is 1,000,000 * 1,000,000. For unexperienced viewers leaving the old for loop in the program could be confusing.

    Reply
  25. Vinod Kumar Gupta says:
    March 24, 2015 at 12:30 pm

    Nice video with ample of information demonstrating comparison of legacy multi threading and modern TPL

    Reply
  26. floflo92du63 says:
    April 29, 2015 at 11:14 pm

    This video really helped me. Thank you !

    Reply
  27. Michael Beck says:
    July 9, 2015 at 7:56 am

    What a nice tutorial!

    Reply
  28. fordfiveohh says:
    October 29, 2015 at 3:11 am

    How do thread branches execute? If I spawn a thread from a thread does it time slice or does it parallelize. I guess I could experiment and find out.

    Reply
  29. fordfiveohh says:
    October 29, 2015 at 3:13 am

    If you spawn two or more threads manually it will parallelize but you will need callbacks unless its fire and forget.

    Reply
  30. Prakash K says:
    November 2, 2015 at 1:45 pm

    nice explanation. Awesome work.

    Reply
  31. Rashmi Purbey says:
    November 23, 2015 at 8:05 am

    video for mutex semaphore, semaphoreslim is missing in questpond.com. Pls put it back

    Reply
  32. CodeKiller says:
    February 15, 2016 at 9:23 am

    P2(intel Pentium 2) is single core btw

    Reply
  33. Lucky Guest says:
    February 15, 2016 at 2:20 pm

    Good video. Liked the perfmon demo.

    Reply
  34. Aurelio Medina says:
    March 4, 2016 at 6:15 am

    great video,

    Reply
  35. Ron Danish says:
    June 12, 2016 at 12:53 am

    Questpond has top notch videos and the explanations are among the best anywhere. Especially the design patterns series – simple to grasp some complex subjects! Excellent job Questpond! I'll likely sign up with them shortly.

    Reply
  36. Sayed Reda says:
    June 30, 2016 at 12:12 pm

    Where is the second part of TPL video?

    Reply
  37. Edward bradman says:
    December 2, 2016 at 2:31 pm

    really good video. what i suspected was happening but very clever way of proving it.

    Reply
  38. TallCoolDrink says:
    April 5, 2017 at 3:16 pm

    I love your concise to the point tutorials….Very helpful.

    Reply
  39. Ashish Trivedi says:
    May 18, 2017 at 7:35 pm

    There seems to be a misconception here, when we spawn a new thread like shown in first part off video, it is not for completing task faster, it is just for making calling thread free and assigning task to another thread. By this its obvious that all cores of cpu will not take same load. Because spawned thread running on one core is processing assigned task and meanwhile calling thread finishes with main function.

    Reply
  40. UltraStoat says:
    July 18, 2017 at 4:55 pm

    The explanation here is not correct. He took a single threaded "for loop" and placed it on a single thread. Well, that is in fact multi threading. Your fist thread is the thread of your application itself. The second thread is the "for loop", for a total of 2 threads. What you are really talking about is parallelizing work that is "normally" single threaded, which is distinctly different.

    Reply
  41. Praveen Kumar says:
    November 25, 2017 at 3:24 am

    Excellent 👌👌

    Reply
  42. ShubhaM JaisWaL says:
    April 24, 2018 at 3:00 pm

    how to implement this in infinite loop?

    Reply
  43. eric nwaogwugwu says:
    April 26, 2018 at 2:39 pm

    Is this code not doing 1 million * RunMillionIterations() I think you can drop the one of the for… probably the one inside RunMillionIterations

    Reply
  44. Mohit Agarwal says:
    May 6, 2018 at 10:59 am

    Good one 👍🏻

    Reply
  45. Sean Hoffman says:
    May 8, 2018 at 12:24 pm

    Fast-forward to 8:31 if you already understand threading and using perfmon and actually wish to get to TPL.

    Reply
  46. zvi g says:
    August 11, 2018 at 10:56 pm

    In the first example you run a single thread and in the second you run MANY threads

    Reply
  47. Sadam4 Siyal says:
    December 18, 2018 at 3:08 am

    Good video

    Reply
  48. Felice Pollano says:
    February 5, 2019 at 4:45 pm

    I have to say that concatenating a string with s = s+"x" one million times is absolute a killer for memory and GC

    Reply
  49. Hussain Haydari says:
    February 22, 2019 at 8:35 am

    Please set your second video here

    Reply
  50. Shuky Persky says:
    March 16, 2019 at 12:44 pm

    Nice video. thanks to the creator. However, it raises a few questions:

    1. What if I wish to run a task forever according to its own logic
    (in which case the 'For" of the Parallel.For is not required).
    Thus, I need a one time launch … and let the thread run as long as its own logic says so.

    2. How do I enquire a core's overload to correctly set task-core affinity?

    3. Which API is used to set affinity?

    4. I don't understand why the Parallel.For is used … there is a for () loop statement in the task's code?

    5. It is unclear to me from the core overload chart whether we see 4 identical tasks running on 4 cores concurrently?

    If this is a single task running on all 4 cores. then:
    (a) what exactly controls splitting its work among cores and then combine the results as if it was executed on a single core.
    (b) how come the overload of all cores is similar to the overload of the execution of a single core. Where is the benefit?
    in the execution period length?

    Reply
  51. Manjeet Nandal says:
    August 21, 2019 at 1:41 pm

    Nice. Many thanks!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • ART TRIP: DETROIT
  • Summer to fall: transitional wardrobe tips | CAPSULE GUIDE | Justine Leconte
  • Gene Nelson – ‘Zing! Went the Strings of my Heart’ – Lullaby of Broadway (1951)
  • How to repair stripped spark plug threads PERMANENTLY
  • Unboxing: Ruger 10/22 barrel thread adapters
  • Andrew Fitzsimons’ Nighttime Skincare Routine | Go To Bed With Me | Harper’s BAZAAR
  • Andrew McAfee: “More From Less” | Talks at Google
  • Why Modern Art Is So Expensive | So Expensive
  • I Went To A BRITISH Art Store for the FIRST TIME!!
  • HSN | G by Giuliana Rancic Fashions 12.05.2019 – 04 PM

Recent Comments

  • 結月Darklorel on Why Modern Art Is So Expensive | So Expensive
  • Mary Jazly on Why Modern Art Is So Expensive | So Expensive
  • Michi MJ on Why Modern Art Is So Expensive | So Expensive
  • Nikolette Krissoff on Why Modern Art Is So Expensive | So Expensive
  • D Tama on Why Modern Art Is So Expensive | So Expensive

Tags

and craft crafting crafts crochet diy easy embroidery fabric fashion free free quilting classes free quilting tutorial going Hand Embroidery howto how to how to knit how to quilt how to sew Jenny Doan knit knitting learn to quilt Missouri star Missouri star quilt company msqc quilt quilting quilting lessons quilting precuts quilting tutorial quilt tutorial sew sewing sewing fabric sewing tutorial stitch that the this thread tutorial yarn you
© 2019 Tartan House Canada | All rights reserved.