.NET interview questions and answers: - What is TPL?
- By Shiv Prasad Koirala in .Net
- Feb 16th, 2013
- 29496
- 0
This question is taken from threading chapter from .NET interview question and answers bookwritten by Shivprasadkoirala and published by BPB publications.
If you are new to c# threading, see this video c# threading interview question :- What is threading ?
TPL stands for Task parallel library. Its introduced in .NET 4.0 framework to simplify threading.TPL is set of API's which sits on top of core threading and simplifies threading. When we use threading API directly you need to take care of pooling, ensure that thread executes on multiple processors, data and task parallelism etc. When you use TPL all these things are taken care of so that you concentrate on the work rather than these lower level technical details.
TPL simplifies the following things from development aspect :-
• Thread pooling is taken care internally.
• TPL ensures that threads will execute on multiple processors.
• Cancellation of threads made easier.
• State management simplified as compared to core threading.
All components of TPL (task parallel library) exists in the below namespace.
To invoke a thread using TPL we need to use the below syntax We need to create the object of task object to invoke a thread.
tsk.Start();
There are more such 500 c# and .NET interview questions and answers visit www.questpond.com
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more