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

31
1



For more such videos visit
For more such videos subscribe

See our other Step by Step video series below :-
Learn C# Step by Step
Learn Design Pattern Step by Step:-
Learn Angular tutorial step by step
Learn MVC Core step by step :-
Learn Azure Step by Step :-
Learn SharePoint Step by Step in 8 hours:-
Python Tutorial for Beginners:-
Learn Data Science in 1 hour :-
Learn Power BI Step by Step:-
Learn MSBI Step by Step in 32 hours:-
Learn SQL Server Step by Step
Learn Tableau step by step :-

In this video we will see 3 big uses of TPL( Task parallel library)
parallel processing,pooling and abstraction. We also point how threads differ from threads.

We are also distributing a 200 page Ebook “.NET Interview Question and Answers”. If you want this ebook please share this video in your facebook/twitter/linkedin account and email us on
questpond@questpond.com with the shared link and we will email you the PDF.

Nguồn:https://wijstaanvooronzegrondrechten.org/

Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe

31 COMMENTS

  1. 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?

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

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

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

  10. 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. 

LEAVE A REPLY

Please enter your comment!
Please enter your name here