Hello , I have a small question using Parrallism in c# , why did Microsoft came up with Task Parallel Library(TPL) .. why they did not use only threads in other words what did the TPL overcame in the threads problems??
Can some one help me to understand?

Recommended Answers

All 2 Replies

We may never know who and why to this one. https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/task-parallel-library-tpl holds the usual answer.

Before TPL I found I had to implement my own solution in order to "soak" all the computer cores. At the time I was using Visual Studio 2008 and C# and it's threading was not availing itself of the other CPU cores. Maybe that changed but I haven't had an app that needed this yet.

commented: Thank you for responding .I have read what Microsoft wrote about the TPL .. but what I was looking for is what did TPL do the threads could not do. +0

Remember I haven't needed this since about 2010 to 2015 and I don't recall TPL back then. TPL claims to scale and the threading in .NET/C# wasn't that capable. It did thread but only on a single core of the CPU. So you had to be creative to tap all the cores.

Try this. See if threads now spread out among the cores. If they do, Microsoft fixed that. And then test in TPL and see if TPL was their solution.

Maybe it's all in that one word "scaling."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.