Visual Studio 2010 has provided lots of facilities for developers writing applications targeting various .NET versions. The .NET 4.0 Framework has introduced task parallel library using which you can write code which makes use of the available cores on the deployment machine.
Now as a developer, if you are working on multiple asynchronous operations, you can make use of the Task class. I have already explained the mechanism of coding using task parallel library over here.
Now if you want to view the visual schedule of the parallel tasks and see each object in the thread, Visual 2010 has provided us this capability using Debug > Windows > Parallel Task window.
Let’s consider the following console application:
Step 1: To view the ‘Parallel Task’ window, put a BREAKPOINT on the ‘taskDepartments’ declaration code as shown below:
Step 2: Run the application and click on Debug > Windows > Parallel Tasks. You will see the Parallel Task Window as circled below:
Step 3: Now step through the code, and you will find the Task entries in the Parallel Tasks Window as shown below:
The above image of the Parallel Tasks window shows that two Tasks are running. Currently the control is on the ‘taskDepartments’ task object, so the Location provides the operation being handled by the current running task.
Similarly, in the above image, we can see that the task ‘taskEmployees’ is running and handling ‘ReadAllEmployees’ operation.
In both the images, the ‘Thread Assigned’ represents the thread on which the Tasks are running.
Conclusion: With the use of Visual Studio 2010 and Task Parallel Framework in .NET 4.0, it is easy for the developer to work on parallel programming and monitor it.
Will you give this article a +1 ? Thanks in advance