Parallel Extension in .NET 4.0 (Part 4 – Debugging Support from IDE)

What we have cover so far?

So far in the Parallel Extension series, I’ve talked about:

  1. Introduction and Motivation of Parallel Extension
  2. The Task Parallel Library in Parallel Extension
  3. PLINQ (Parallel version of LINQ)

Introduction

In this post, I’ll discuss about the Debugging and Visualization Support from IDE, namely Visual Studio 2010.

When running the parallel-enabled application, you perhaps wondering the following things:

  • how many threads / tasks you have created?
  • for each thread, what’s the status?
  • is it waiting, running, or completed?
  • should i kill the thread manually or not?
  • is there any potential deadlock happen? Thinking

It’s really really challenging to answer those questions without a support from the IDE. Fortunately, VS2010 makes those things happen by visualizing them into an comprehensive views.

Without further due, let’s see how it works.

I’ll use the demo code as in the second post of this series about Task Parallel Library.

Debugging Support – Parallel Tasks Window

Step 1 – Put a break point at the Parallel.For section as following.

image

Step 2 – Run the application by simply click F5.

As expected, the program will stop at the breakpoint.

Step 3 – On the menu, click Debug – Windows – Parallel Tasks.

image

Immediately, the Parallel Tasks Windows will appear. Initially, it should show nothing on the screen.

Step 4 – Click on Step Into / F11 to begin our parallel loop.

image

As you can see that the Parallel Tasks windows will start to show the first task that is running and the second task is being scheduled.

Step 5 – You may click on Step Over button or F10 to continue to see the created tasks.

image

Step 6 – It’s also worth to note that you could set the view to parent – child view, so that you know which parent a task belong to.

image

Step 7 – Alternately, you could group each task by Location where the tasks are.

image 

Reference

Do you like this feature? I hope you do Smile.

In the subsequent post, I’ll talk more sophisticated feature about how to visualize the task / thread. Stay tuned here.

Share this post: | | | |
Published Monday, April 26, 2010 7:59 PM by Wely

Comments

# Parallel Extension in .NET 4.0 (Part 5 – Visualization Support from IDE)

Sunday, May 02, 2010 7:37 PM by Wely Lau

What we have cover so far? So far in the Parallel Extension series, I’ve talked about: Introduction and

Powered by Community Server (Commercial Edition), by Telligent Systems