Monday, 30 January 2012

Introduction to TPL part 2 - Task

We have understood the background of the Task parallel library in the previous post. Now we need to concentrate on the building blocks of the library namely Task, Task scheduler, Blocking collection and the PLINQ.

Each of the TPL block has description of the features and example(s) associated with it. In this article I would like to discuss about the “Task” in this post.

Task

Coming right from the world of System.Threading.Thread a task looks little different. A TPL Task is nothing but a well wrapped Thread and having good infrastructure. TPL is still wrapped around the same namespace. TPL Task can be found in the namespace Syste.Threading.Tasks. TPL task has same ability to of a Thread object and been extended.

The below code shows how a thread and a TPL task can be used in typical scenarios

Tuesday, 3 January 2012

Introduction to TPL Part 1


For many years we have seen the Processor clock frequency going up. Well there is vertical limit. All of a sudden we are seeing processors having multiple cores. Well, what is a multicore processor? We can approximately say that multiple processors with in one processor.  These internal processors are called Cores.  Each of these cores can execute two threads (hardware threads) at a time (based on architecture). Here we must not assume that these hardware threads are executing by switching. But these are getting executed in parallel in real time.